// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
// ┃ ██████ ██████ ██████       █      █      █      █      █ █▄  ▀███ █       ┃
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█  ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄  ▀█ █ ▀▀▀▀▀ ┃
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄   █ ▄▄▄▄▄ ┃
// ┃ █      ██████ █  ▀█▄       █ ██████      █      ███▌▐███ ███████▄ █       ┃
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
// ┃ 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 {
    #status_bar.titled {
        padding-right: 108px;

        #menu-bar {
            opacity: 0.2;
        }
    }

    // When settings open ...
    #main_column #status_bar,
    #main_column #status_bar.titled {
        padding-left: 0px;
        padding-right: 36px;

        input::placeholder {
            color: var(--inactive--color);
        }

        #menu-bar {
            opacity: 1;
        }
    }

    #status_bar {
        box-shadow: 0 13px 0 -12px var(--inactive--border-color);
        z-index: 1;
        display: flex;
        align-items: center;
        background: var(--plugin--background);
        padding: 0;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: var(--status-bar--height, 48px);
        border-radius: var(--status-bar--border-radius);
        #status-bar-placeholder {
            margin: 0px;
            pointer-events: none;
        }

        input {
            font-size: 1em;
        }

        input:placeholder-shown + #status-bar-placeholder:before {
            content: var(--untitled--content, "untitled");
            color: var(--inactive--color);
        }

        .input-sizer {
            display: inline-block;
            align-items: center;
            position: relative;
            margin-top: 1px;
            min-width: 65px;
            overflow: hidden;

            &:after,
            input,
            textarea {
                width: auto;
                grid-area: 1 / 1;
                font-family: inherit;
            }

            input,
            textarea {
                // grid-area: 1 / 1;
                position: absolute;
                left: 0;
                right: 0;
                text-overflow: ellipsis;
                padding: 0;
                border: none;
                background: transparent;
                color: inherit;
                height: 100%;
            }

            &:after {
                content: attr(data-value) " ";
                color: var(--inactive--color, inherit);
                visibility: hidden;
                white-space: nowrap;
                padding-right: 12px;
            }

            &:focus-within {
                textarea:focus,
                input:focus {
                    outline: none;
                }
            }
        }

        .app-title {
            margin-left: 12px;
            font-size: 16px;
        }

        .section {
            display: flex;
            align-items: center;
        }

        #spacer {
            flex: 1 1000 auto;
        }

        #rows {
            flex: 0 1000 auto;
            overflow: hidden;
            margin: 0px 14px;
            span {
                white-space: nowrap;
                margin: 0 !important;
            }

            span span {
                color: var(--inactive--color);
            }
        }

        // Exceptions when the menu bar is visible and the settings panel is closed.
        #menu-bar {
            flex: 0 1000000 auto;
            .button {
                height: 22px;
            }
        }

        #plugin-settings {
            margin-left: auto;
        }

        #counter-arrow:before {
            content: var(--status-bar-counter--content, "arrow_back");
        }

        span {
            // font-size: var(--label--font-size, 0.75em);
            margin: 0px 14px;
            user-select: none;
            height: 100%;
            line-height: 36px;

            &:before {
                position: relative;
            }

            &:hover {
                color: inherit;
            }
        }

        span#rows {
            margin-left: 2px;
        }

        span.icon {
            height: 100%;
            line-height: 36px;
            margin: 0;
        }

        span#status {
            width: 20px;
            height: 20px;
            background-repeat: no-repeat;
            background-color: var(--icon--color);
            content: "";
            -webkit-mask-size: cover;
            mask-size: cover;
            pointer-events: none;
            image-rendering: pixelated;
        }

        // span#status_updating

        span#status.loading {
            image-rendering: pixelated;
            mask-image: url("../svg/downloading.gif");
            -webkit-mask-image: url("../svg/downloading.gif");
        }

        span#status.uninitialized {
            background-color: transparent;
        }

        span#status.connected,
        span#status.updating {
            mask-image: url(../svg/status_ok.svg);
            -webkit-mask-image: url(../svg/status_ok.svg);
        }

        // Status bar status icon animations
        span#status_updating {
            position: absolute;
            opacity: 0;
            width: 20px;
            height: 20px;
            background-repeat: no-repeat;
            background-color: var(--icon--color);
            content: "";
            -webkit-mask-size: cover;
            mask-size: cover;
            pointer-events: none;
            image-rendering: pixelated;
            mask-image: url("../svg/updating.gif");
            -webkit-mask-image: url("../svg/updating.gif");
        }

        // span#status.uninitialized {

        // }

        span#status.updating {
            animation-name: status-bar-updating-inverse;
            animation-fill-mode: forwards;
            animation-iteration-count: 1;
            animation-duration: 0.3s;
        }

        span#status_updating.updating {
            animation-name: status-bar-updating;
            animation-fill-mode: forwards;
            animation-iteration-count: 1;
            animation-duration: 0.3s;
        }

        .button:before {
            height: 21px;
            width: 21px;
            background-repeat: no-repeat;
            background-color: var(--icon--color);
            content: "";
            -webkit-mask-size: cover;
            mask-size: cover;
            pointer-events: none;
        }

        span#export {
            &:before {
                -webkit-mask-image: url("../svg/export-icon.svg");
                mask-image: url("../svg/export-icon.svg");
            }
            span:before {
                content: var(--export-button--content, "Export");
            }
        }

        span#lock {
            &:before {
                -webkit-mask-image: url("../svg/free-scroll-icon.svg");
                mask-image: url("../svg/free-scroll-icon.svg");
            }
        }

        span#reset {
            &:before {
                -webkit-mask-image: url("../svg/revert-icon.svg");
                mask-image: url("../svg/revert-icon.svg");
            }
            span:before {
                content: var(--reset-button--content, "Reset");
            }
        }

        span#copy {
            &:before {
                -webkit-mask-image: url("../svg/duplicate-icon.svg");
                mask-image: url("../svg/duplicate-icon.svg");
            }
            span:before {
                content: var(--copy-button--content, "Copy");
            }
        }

        #theme {
            height: 48px;
            &:before {
                -webkit-mask-image: url("../svg/theme-icon.svg");
                mask-image: url("../svg/theme-icon.svg");
            }
        }

        #menu-bar .button select#theme_selector {
            height: 48px;
        }

        .button {
            display: inline-flex;
            justify-content: center;
            align-items: center;
            margin: 0px;
            padding: 0 5px;
            color: var(--inactive--color, #ccc);
            border: 1px solid transparent;
            border-radius: 3px;
            font-size: var(--label--font-size, 0.75em);

            & > span,
            & > .dropdown-width-container {
                pointer-events: none;
                overflow: hidden;
                display: none;
            }

            &:before {
                z-index: 1;
            }
        }

        .hover-target {
            margin: 0;
            display: inline-flex;
            align-items: center;
            height: 48px;
            cursor: pointer;
            &:hover,
            &.modal-target {
                box-shadow: -4px 0 0 var(--icon--color),
                    4px 0 0 var(--icon--color);
                background-color: var(--icon--color);
            }

            &:hover .button select {
                background-color: transparent;
            }

            .modal-target .button > span {
                color: var(--icon--color) !important;
            }

            &:hover .button,
            &.modal-target .button {
                position: relative;
                min-width: var(--button--min-width, 33px);
                color: inherit;
                cursor: pointer;
                transition: none;
                background-color: var(--icon--color);
                color: var(--plugin--background);

                &:before {
                    background-color: var(--plugin--background);
                }

                // The label.
                @mixin label {
                    display: block;
                    text-align: center;
                    position: absolute;
                    top: calc(100% + 3px);
                    left: 50%;
                    translate: -50%;
                    margin: 0;
                    padding: 5px;
                    height: auto;
                    white-space: nowrap;
                    line-height: 1;
                    width: 41px;
                    background-color: var(--icon--color);
                    border-radius: 0 0 3px 3px;
                }

                & > span {
                    @include label;
                }

                & > .dropdown-width-container {
                    display: block;
                    margin: 0;
                    height: auto;
                    white-space: nowrap;
                    line-height: 1;
                    background-color: var(--icon--color);
                    pointer-events: all;

                    & > select {
                        position: static;
                        cursor: pointer;
                    }

                    &::before {
                        content: "";
                        display: block;
                        position: absolute;
                        inset-block-start: -3px;
                        inset-inline-start: 0;
                        inline-size: 100%;
                        block-size: 3px;
                    }
                    &::after {
                        content: none;
                    }
                }
            }
        }
    }
}

@keyframes status-bar-updating {
    0% {
        opacity: 0;
    }

    99% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes status-bar-updating-inverse {
    0% {
        opacity: 1;
    }

    99% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}
