﻿.bb-g-search {
    --bb-global-search-padding: 0.25rem 0.75rem;
    --bb-global-search-width: 168px;
    --bb-global-search-input-color: rgba(var(--bs-body-color-rgb), 0.5);
    display: flex;
    align-items: center;
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: var(--bb-global-search-padding);
    width: var(--bb-global-search-width);
    transition: border-color .3s linear;
    color: var(--bb-global-search-input-color);
}

    .bb-g-search:hover {
        border: var(--bs-border-width) solid var(--bb-border-hover-color);
    }

    .bb-g-search > input {
        width: 100%;
        background-color: transparent;
        border: none;
        line-height: 1.5;
        padding: 0;
        cursor: pointer;
    }

        .bb-g-search > input::placeholder {
            color: var(--bb-global-search-input-color);
        }

.search-dialog-icon {
    cursor: pointer;
    margin-inline-end: .5rem;
}

.search-dialog-mask {
    --bb-global-search-item-active-bg: rgba(var(--bs-emphasis-color-rgb), 0.2);
    --bb-global-search-item-hover-bg: rgba(var(--bs-emphasis-color-rgb), 0.1);
    --bb-global-search-dialog-input-focus-border-color: rgba(var(--bs-emphasis-color-rgb), 0.4);
    --bb-global-search-highlight-color: #0078d4;
    --bb-global-search-dialog-mask-z-index: 1092;
    --bb-global-search-footer-shadow: 0 -1px 0 0 #e0e3e8, 0 -3px 6px 0 rgba(69, 98, 155, .12);
    --bb-global-search-main-max-height: calc(100vh - 260px);
    --bb-global-search-footer-kbd-bg: var(--bs-body-color);
    --bb-global-search-footer-kbd-color: var(--bs-body-bg);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--bb-global-search-dialog-mask-z-index);
    background-color: rgba(var(--bs-emphasis-color-rgb), 0.3);
    justify-content: center;
    display: none;
}

    .search-dialog-mask .search-dialog-item ol {
        margin: .5rem 0 0 0;
    }

    .search-dialog-mask .search-key {
        display: inline-block;
        margin: 0;
        color: var(--bb-global-search-highlight-color);
        font-weight: bold;
        font-style: normal;
    }

    .search-dialog-mask kbd {
        color: var(--bb-global-search-footer-kbd-color);
    }

[data-bs-theme='dark'] .search-dialog-mask {
    --bb-global-search-footer-kbd-color: var(--bs-body-color);
}

.bb-g-search-open {
    overflow: hidden;
}

    .bb-g-search-open .search-dialog-mask {
        display: flex;
    }

.search-dialog {
    width: calc(100vw - 4rem);
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    border-radius: var(--bs-border-radius);
    border: var(--bs-border-width) solid var(--bs-border-color);
    margin: 1rem auto auto;
}

.search-dialog-input {
    border-radius: 10px;
    border: var(--bs-border-width) solid var(--bs-border-color);
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    transition: border-color .3s linear;
    margin: .5rem;
}

    .search-dialog-input input {
        background-color: transparent;
        border: none;
        line-height: 25px;
        padding: 0;
        margin: 0 .5rem;
        flex-grow: 1;
    }

        .search-dialog-input input::placeholder {
            color: rgba(var(--bs-body-color-rgb), 0.5);
        }

    .search-dialog-input:has(input:focus) {
        border-color: var(--bb-global-search-dialog-input-focus-border-color);
    }

    .search-dialog-input .search-dialog-clear {
        cursor: pointer;
    }

.search-dialog-status {
    color: rgba(var(--bs-body-color-rgb), 0.5);
}

.search-dialog-main {
    display: flex;
    margin: .5rem;
}

.search-dialog-menu {
    flex-basis: 240px;
    margin-inline-start: 0.5rem;
    padding: .5rem .25rem;
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    font-size: 13px;
    display: none;
    max-height: var(--bb-global-search-main-max-height);
}

    .search-dialog-menu .search-dialog-menu-item {
        padding: .25rem .5rem;
        display: block;
        color: var(--bs-body-color);
        border-radius: var(--bs-border-radius);
    }

        .search-dialog-menu .search-dialog-menu-item:not(:last-child) {
            margin-block-end: .125rem;
        }

        .search-dialog-menu .search-dialog-menu-item:hover {
            background-color: var(--bb-global-search-item-hover-bg);
        }

        .search-dialog-menu .search-dialog-menu-item.active {
            background-color: var(--bb-global-search-item-active-bg);
        }

.search-dialog-list {
    flex: 1;
    overflow: auto;
    max-height: var(--bb-global-search-main-max-height);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: .25rem;
}

    .search-dialog-list .search-dialog-item {
        display: block;
        border: var(--bs-border-width) solid var(--bs-border-color);
        border-radius: var(--bs-border-radius);
        padding: .5rem;
        position: relative;
        transition: border-color .3s linear, background-color .3s linear;
    }

        .search-dialog-list .search-dialog-item:not(:first-child) {
            margin-block-start: .5rem;
        }

        .search-dialog-list .search-dialog-item a {
            color: var(--bs-body-color);
        }

        .search-dialog-list .search-dialog-item .badge {
            --bs-badge-border-radius: 50%;
            position: absolute;
            top: 4px;
            margin-inline-start: 4px;
        }

        .search-dialog-list .search-dialog-item .search-dialog-item-sub {
            font-size: .75rem;
            margin-block-start: .25rem;
            opacity: .8;
        }

        .search-dialog-list .search-dialog-item li {
            padding: .125rem;
            border-radius: var(--bs-border-radius);
            transition: background-color .3s linear;
        }

            .search-dialog-list .search-dialog-item li:not(:first-child) {
                margin-block-start: .125rem;
            }

            .search-dialog-list .search-dialog-item li > a {
                display: block;
                padding: .125rem;
                font-size: .75rem;
            }

            .search-dialog-list .search-dialog-item li:hover,
            .search-dialog-list .search-dialog-item li.active {
                background-color: var(--bb-global-search-item-hover-bg);
            }

    .search-dialog-list .search-dialog-empty-template {
        text-align: center;
        padding: 36px;
        display: block;
    }

.search-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    user-select: none;
    box-shadow: var(--bb-global-search-footer-shadow);
    padding: .5rem;
    font-size: .75rem;
    min-height: 34px;
}

    .search-dialog-footer .search-dialog-commands > div:not(:last-child) {
        margin-right: .5rem;
    }

    .search-dialog-footer .search-dialog-commands kbd {
        background-color: var(--bb-global-search-footer-kbd-bg);
    }

    .search-dialog-footer .search-dialog-logo {
        display: none;
    }

@media(min-width: 576px) {
    .search-dialog {
        width: 500px;
    }

    .search-dialog-footer .search-dialog-logo {
        display: block;
    }
}

@media (min-width: 768px) {
    .search-dialog {
        width: 700px;
        margin: 4rem auto auto;
    }

    .search-dialog-menu.show {
        display: block;
    }
}

@media (min-width: 992px) {
    .search-dialog {
        width: 900px;
    }
}
