//
// Dropdown/Modal search window
// --------------------------------------------------

@if not $prev-search {
    #dropdown-search.dropdown-menu {
        left: auto;
        right: 0;
        max-width: 100%;
        min-width: 400px;
        padding: 0;
        border: none;
        border-radius: 8px;
        top: 115%;

        &.show {
            display: flex;
            flex-direction: column;
            max-height: calc(100vh - var(--hh-fixed-header-height) - var(--hh-mobile-app-safe-area-inset-bottom, env(safe-area-inset-bottom)));

            @include media-breakpoint-down(md) {
                max-height: calc(100vh - 15px - var(--hh-fixed-header-height) - var(--hh-mobile-app-safe-area-inset-bottom, env(safe-area-inset-bottom)));
            }
        }

        .dropdown-header {
            font-size: 20px;
            font-weight: 600;
            color: var(--hh-text-color-highlight);
            padding: 24px 24px 16px;
            margin: 0;
            flex: 0 0 auto;

            .arrow {
                position: absolute;
                display: block;
                width: 0;
                height: 0;
                border-color: transparent;
                border-style: solid;
                border-width: 8px;
                right: 10px;
                margin-left: -18px;
                border-top-width: 0;
                border-bottom-color: var(--hh-background4);
                top: -8px;
                z-index: 1035;

                &:after {
                    position: absolute;
                    border-color: transparent;
                    border-style: solid;
                    border-width: 8px;
                    content: " ";
                    top: 1px;
                    margin-left: -8px;
                    border-top-width: 0;
                    border-bottom-color: var(--hh-background-color-main);
                    z-index: 1035;
                }
            }

            #dropdown-search-close {
                float: right;
                font-size: 18px;
                cursor: pointer;
            }
        }

        .dropdown-search-form {
            position: relative;
            padding: 0 16px 16px;
            flex: 0 1 auto;

            .dropdown-search-keyword {
                background: var(--hh-background-color-secondary);
                border-color: var(--hh-background-color-secondary);
                border-radius: 6px;
                padding-left: 32px;
                font-weight: 500;

                &:-webkit-autofill,
                &:-webkit-autofill:hover,
                &:-webkit-autofill:focus,
                &:-webkit-autofill:active {
                    -webkit-text-fill-color: var(--hh-text-color-secondary) !important;
                    -webkit-box-shadow: 0 0 0 30px var(--hh-background-color-secondary) inset !important;
                }
            }

            .dropdown-search-button {
                position: absolute;
                padding: 5px 10px;
                background: none;
                border: 0;
                font-size: 16px;
                font-weight: 600;
                color: var(--hh-text-color-secondary) !important;
                box-shadow: none;

                &:active {
                    box-shadow: none;
                }
            }
        }

        .dropdown-search-list {
            list-style: none;
            padding: 0 16px 24px;
            flex: 0 1 auto;

            > li:first-child {
                margin-top: 0;
                padding-top: 0;
            }
        }

        .search-provider {
            display: none;
            padding-top: 16px;

            .search-provider-title {
                padding: 8px;
                font-weight: 600;
                font-size: 18px;
                color: var(--hh-text-color-highlight);

                > span {
                    font-size: 14px;
                }
            }

            &:hover {
                color: inherit;
            }

            &.provider-searched {
                display: block;
            }

            &.provider-searching {
                .search-provider-title, .search-provider-content {
                    float: left;
                }
            }

            .search-provider-content {
                > .hh-loader {
                    margin-top: 10px;

                    .spinner-border {
                        width: 1rem;
                        height: 1rem;
                    }
                }

                a.search-provider-record {
                    display: flex;
                    align-items: center;
                    padding: 8px;

                    &:hover, &:focus {
                        background: var(--hh-background-color-secondary);
                        border-radius: 3px;
                        outline: none;
                    }

                    .search-provider-record-image {
                        width: 36px;
                        flex: 0 0 36px;

                        > i.fa {
                            font-size: 25px;
                            color: var(--bs-accent);
                            background: var(--hh-background-color-secondary);
                            border-radius: 4px;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            width: 36px;
                            height: 36px;
                            margin: 0;
                        }
                    }

                    .search-provider-record-text {
                        padding-left: 16px;
                        flex: 1;
                        min-width: 0;

                        > span {
                            display: block;
                            text-overflow: ellipsis;
                            overflow: hidden;
                            white-space: nowrap;

                            &:first-child { //Title
                                font-size: 14px;
                                font-weight: 500;
                            }

                            &:last-child { // Description
                                font-size: 12px;
                                font-weight: 400;
                                color: var(--hh-text-color-soft);
                            }
                        }
                    }
                }
            }

            .search-provider-no-results {
                padding: 8px;
            }

            .search-provider-actions {
                padding: 16px 8px 0;

                .btn {
                    width: 100%;
                    font-size: 12px;
                }
            }
        }
    }

    .dropdown.search-menu {
        .dropdown-backdrop {
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 990;
            background: rgba($text-color-highlight, 0.15);
        }

        #search-menu.show {
            background: var(--hh-background-color-main);
            border-bottom: 3px solid var(--bs-accent);
            z-index: 1000;
            position: relative;
        }
    }

    @include media-breakpoint-down(sm) {
        .dropdown.search-menu {
            position: initial;
        }
        #dropdown-search.dropdown-menu {
            width: 100%;
            min-width: initial;

            .dropdown-header .arrow {
                right: 25px;
            }
        }
    }

    // Search results page list:
    .search-results-header {
        color: var(--hh-text-color-highlight);
        font-size: 12px;
        line-height: 1.5;
        padding: 10px 0 15px;
        margin-bottom: 10px;
        border-bottom: 1px solid var(--hh-background3);
    }
}
