/* ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
 * ┃ ██████ ██████ ██████       █      █      █      █      █ █▄  ▀███ █       ┃
 * ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█  ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄  ▀█ █ ▀▀▀▀▀ ┃
 * ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄   █ ▄▄▄▄▄ ┃
 * ┃ █      ██████ █  ▀█▄       █ ██████      █      ███▌▐███ ███████▄ █       ┃
 * ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
 * ┃ Copyright (c) 2017, the Perspective Authors.                              ┃
 * ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
 * ┃ This file is part of the Perspective library, distributed under the terms ┃
 * ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
 * ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
 */

:host {
    --settings-panel-z-index: 10;
    --psp--color: #ff0000;
}

::slotted(*) {
    pointer-events: var(--override-content-pointer-events);
}

:host .sidebar_close_button {
    position: absolute;
    top: 0;
    padding-top: calc(
        (
                var(
                        --psp-plugin-selector--height,
                        var(--psp-status-bar--height, 48px)
                    ) -
                    20px
            ) /
            2
    );
    padding-bottom: calc(
        (
                var(
                        --psp-plugin-selector--height,
                        var(--psp-status-bar--height, 48px)
                    ) -
                    20px
            ) /
            2
    );
    z-index: 10000;
    height: var(
        --psp-plugin-selector--height,
        var(--psp-status-bar--height, 48px)
    );

    &:hover {
        cursor: pointer;
    }

    .sidebar_close_button_inner {
        border-radius: 5px 0 0 5px;
        height: 20px;
        background-color: var(--psp--background-color);
    }

    .sidebar_close_button_inner .icon {
        display: inline-block;
        mask-size: cover;
        -webkit-mask-size: cover;
        background-repeat: no-repeat;
        background-color: var(--psp--color);
        mask-image: var(--psp-icon--drawer-tab--mask-image);
        -webkit-mask-image: var(--psp-icon--drawer-tab--mask-image);

        &:before {
            content: var(--psp-icon--drawer-tab--mask-image);
            visibility: hidden;
        }
    }

    &:hover .sidebar_close_button_inner .icon {
        mask-image: var(--psp-icon--drawer-tab-hover--mask-image);
        -webkit-mask-image: var(--psp-icon--drawer-tab-hover--mask-image);
    }
}

:host #settings_close_button,
:host #column_settings_close_button {
    left: -21px;
}

:host #debug_close_button.sidebar_close_button .sidebar_close_button_inner {
    background-attachment: fixed;
    background: var(--psp-sidebar--background);

    .icon {
        mask-image: var(--psp-icon--drawer-tab-hover--mask-image);
        -webkit-mask-image: var(--psp-icon--drawer-tab-hover--mask-image);
    }
}

:host
    #debug_close_button.sidebar_close_button:hover
    .sidebar_close_button_inner
    .icon {
    mask-image: var(--psp-icon--drawer-tab--mask-image);
    -webkit-mask-image: var(--psp-icon--drawer-tab--mask-image);
}

:host #debug_open_button.sidebar_close_button {
    right: 0px;
    cursor: pointer;

    .sidebar_close_button_inner {
        background-color: transparent;
    }
}

:host #debug_open_button.sidebar_close_button .sidebar_close_button_inner {
    .icon {
        mask-image: var(--psp-icon--drawer-tab-inverted--mask-image);
        -webkit-mask-image: var(--psp-icon--drawer-tab-inverted--mask-image);
    }

    &:hover .icon {
        mask-image: var(--psp-icon--drawer-tab-inverted-hover--mask-image);
        -webkit-mask-image: var(
            --psp-icon--drawer-tab-inverted-hover--mask-image
        );
    }
}

:host #debug_close_button.sidebar_close_button {
    right: 0px;
}

:host(:hover) {
    #menu-bar {
        opacity: 1 !important;
    }

    #component_container #settings_button,
    #component_container #settings_button.titled {
        opacity: 1;
    }
}

:host {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    font-size: 0.75em;

    * {
        box-sizing: border-box;
        line-height: 1.25;
    }

    #component_container {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
    }

    #app_panel {
        position: absolute;
        bottom: 0px;
        left: 0;
        right: 0;
        top: 0;
        height: auto;
        flex-direction: row-reverse;
        & > .split-panel-divider {
            border-left: 1px solid var(--psp-inactive--color, #6e6e6e);
            margin-right: -5px;
        }
    }

    #modal_panel {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        pointer-events: none;
        & > * {
            pointer-events: all;
        }
    }

    #modal_panel > .split-panel-divider {
        border-left: 1px solid var(--psp-inactive--color, #6e6e6e);
        margin-right: -5px;
    }

    #status_bar {
        height: var(--psp-status-bar--height, 48px);
    }

    #main_column_container {
        position: relative;
        display: flex;
        flex: 1 1 auto;
        overflow: hidden;
    }

    #main_column {
        display: flex;
        flex: 1 1 auto;
        overflow: hidden;
        flex-direction: column;
        position: relative;
        margin: var(--psp-main-column--margin);
        border: var(--psp-main-column--border);
        border-width: var(--psp-main-column--border-width);
        border-radius: var(--psp-main-column--border-radius);
    }

    #main_panel_container {
        position: relative;
        height: 100%;
        box-shadow: var(--plugin--box-shadow, none);
        background: var(
            --psp-main-column--background,
            var(--psp--background-color, none)
        );
        overflow: hidden;
        border: var(--psp-plugin--border, none);
    }

    #settings_panel {
        position: relative;
        flex: 0 0 auto;
        padding: 0pc;
        padding-left: 8px;
        box-sizing: border-box;
        width: 100%;
        z-index: var(--settings-panel-z-index);

        & > .split-panel-child {
            overflow: hidden;
        }

        & > .split-panel-divider {
            border-top: 1px solid var(--psp-inactive--color, #6e6e6e);
            border-bottom: 2px solid var(--psp-inactive--color, #6e6e6e);
            margin-left: -9px;
            margin-right: 0px;
            flex: 0 0 4px;
        }
    }

    #column_settings_sidebar .split-panel-divider {
        border-top: 1px solid var(--psp-inactive--color, #6e6e6e);
        border-bottom: 2px solid var(--psp-inactive--color, #6e6e6e);
        margin-left: -9px;
        margin-right: -4px;
        flex: 0 0 4px;
    }

    .noselect {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .sidebar_column {
        background: var(--psp-sidebar--background);
        background-attachment: fixed;

        display: flex;
        list-style: none;
        flex-direction: column;
        flex: 1;

        /* Needs 2 because it must take precedence over teh chart legend. */
        z-index: 2;
    }

    #plugin_selector {
        margin-top: 3px;
        border-bottom-width: 1px;
        border-style: solid;
        border-color: var(--psp-inactive--color, #c5c9d0);
        border-top-width: 0px;
        border-left-width: 0px;
        border-right-width: 0px;
    }

    #component_container > #settings_button {
        opacity: 0;
        position: absolute;
        top: 0;
        right: 0;
        margin: var(--settings-button--margin, 10px 36px 0 0);
        padding: 0;
    }

    #close_button {
        background-color: var(--psp--background-color);
        padding: 0px;
        overflow: hidden;
        display: var(--psp-close-button--display, none);
        align-items: center;
        justify-content: center;
        z-index: 10000;
        border: 1px solid var(--psp-inactive--color);
        border-radius: 5px;
        font-size: 10px;
        font-weight: normal;

        &:hover {
            color: var(--psp--background-color, inherit);
            background-color: var(--psp--color);
            cursor: pointer;
        }

        &:hover .icon {
            background-color: var(--psp--background-color);
        }

        .icon {
            display: inline-block;
            mask-size: cover;
            -webkit-mask-size: cover;
            background-repeat: no-repeat;
            background-color: var(--psp--color);
            mask-image: var(--psp-icon--close--mask-image);
            -webkit-mask-image: var(--psp-icon--close--mask-image);

            &:before {
                content: var(--psp-icon--close--mask-image);
                visibility: hidden;
            }
        }
    }

    #settings_button {
        background-color: var(--psp--background-color);
        padding: 0;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 3;
        border: 1px solid var(--psp-inactive--color);
        border-radius: 5px;
        font-size: 10px;
        font-weight: normal;

        &:hover {
            color: var(--psp--background-color, inherit);
            background-color: var(--psp--color);
            cursor: pointer;
        }

        &:hover .icon {
            background-color: var(--psp--background-color);
        }

        .icon {
            display: inline-flex;
            mask-size: cover;
            -webkit-mask-size: cover;
            background-repeat: no-repeat;
            background-color: var(--psp--color);
            mask-image: var(--psp-icon--drawer-tab-inverted--mask-image);
            -webkit-mask-image: var(
                --psp-icon--drawer-tab-inverted--mask-image
            );

            &:before {
                line-height: 0;
                display: inline-flex;
                content: var(--psp-icon--drawer-tab-inverted--mask-image);
                visibility: hidden;
            }
        }
    }

    .split-panel.orient-reverse
        > .split-panel-child:not(:last-child):not(.is-width-override) {
        max-width: 300px;
    }

    .sidebar_header {
        min-height: var(
            --psp-plugin-selector--height,
            var(--psp-status-bar--height, 48px)
        );
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-bottom: 1px solid var(--psp-inactive--color, #6e6e6e);
    }

    .sidebar_header_title {
        padding-left: 9px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        margin-right: 30px;
    }

    .sidebar_border {
        height: 2px;
        width: 100%;
        background-color: var(--psp-inactive--color, #6e6e6e);
        margin-top: 1px;
        flex-shrink: 0;
        flex-grow: 0;
    }
}
