//
// Navs
// --------------------------------------------------

@if not $prev-nav {
    // Bootstrap overwrite
    // See all available Bootstrap CSS variables: @humhub/protected/vendor/npm-asset/bootstrap/dist/css/bootstrap.css

    .nav {
        --bs-nav-link-hover-color: var(--bs-link-color);
    }

    .nav-tabs {
        --bs-nav-tabs-link-active-bg: var(--hh-background-color-main);
    }

    .nav, .list-group {
        --hh-nav-icon-width: 20px;
    }

    .nav .nav-item > .nav-link > i {
        width: var(--hh-nav-icon-width);
    }

    .tab-sub-menu {
        padding-left: 10px;

        .nav-link {
            &:hover,
            &:focus {
                background-color: var(--hh-background-color-secondary);
                border-bottom-color: var(--bs-nav-tabs-border-color);
            }

            &.active {
                background-color: var(--hh-background-color-main);
                border-bottom-color: transparent;
            }
        }
    }

    .tab-menu {
        padding-top: 10px;
        background-color: var(--hh-background-color-main);

        .nav-tabs {
            padding-left: 10px;

            .nav-link {
                padding-top: 12px;
                border-color: var(--bs-nav-tabs-border-color);
                border-bottom: var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color);
                background-color: var(--hh-background-color-secondary);
                max-height: 41px;
                outline: none;

                &:hover,
                &:focus {
                    padding-top: 10px;
                    border-top: 3px solid var(--bs-nav-tabs-border-color);
                }

                &:hover {
                    background-color: var(--hh-background-color-secondary);
                }

                &.active {
                    padding-top: 10px;
                    border-top: 3px solid var(--bs-accent);
                    background-color: var(--hh-background-color-main);
                    border-bottom-color: transparent;
                }
            }
        }
    }

    ul.tab-menu {
        padding-top: 10px;
        background-color: var(--hh-background-color-main);

        padding-left: 10px;
    }

    ul.tab-menu-settings {
        .nav-link {
            padding-top: 12px;
            border-color: var(--bs-nav-tabs-border-color);
            border-bottom: var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color);
            background-color: var(--hh-background-color-secondary);
            max-height: 41px;
            outline: none;

            &:hover,
            &:focus {
                padding-top: 10px;
                border-top: 3px solid var(--bs-nav-tabs-border-color) !important;
            }

            &:hover {
                background-color: var(--hh-background-color-secondary);
            }

            &.active {
                padding-top: 10px;
                border-top: 3px solid var(--bs-accent) !important;
                background-color: var(--hh-background-color-main);
                border-bottom-color: transparent !important;
            }
        }
    }

    .nav-pills,
    .nav-tabs,
    .account {
        .dropdown-menu {
            background-color: var(--bs-primary);
            border: none;

            li {
                border-left: 3px solid var(--bs-primary);

                &:hover,
                &.selected {
                    border-left: 3px solid var(--bs-accent);
                    color: var(--hh-primary-contrast) !important;
                    background-color: darken($primary, 5%) !important;
                }

                .dropdown-divider {
                    background-color: darken($primary, 5%);
                    border-bottom: none;
                    margin: 9px 1px !important;
                }

                a {
                    color: var(--hh-primary-contrast);
                    font-weight: 400;
                    font-size: 13px;
                    padding: 4px 15px;

                    i {
                        margin-right: 0;
                        font-size: 14px;
                        display: inline-block;
                        width: var(--hh-nav-icon-width);
                    }

                    &:hover,
                    &:visited,
                    &:hover,
                    &:focus {
                        background: none;
                    }
                }
            }
        }

        .nav-link.dropdown-toggle {
            font-size: 16px; // Size of the dropdown caret
            padding-top: 0.2em;
            padding-bottom: 0.2em;
        }
    }

    .nav-pills.preferences {
        position: absolute;
        right: 10px;
        top: 10px;

        .dropdown .dropdown-toggle {
            padding: 4px 2px;

            &:hover {
                background-color: var(--hh-background-color-secondary);
            }

            // Replace the BS caret with 3 horizontal dots (Meatball menu)
            &::after {
                content: "";
                display: block;
                width: 15px;
                height: 15px;
                // Black meatball menu
                background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath d='M3 9.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z'/%3E%3C/svg%3E");
                // For vertical dots (Kebab menu): background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath d='M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z'/%3E%3C/svg%3E");
                background-repeat: no-repeat;
                background-position: center;
                background-size: contain;
                vertical-align: middle;
                border: none; // Remove the BS caret
            }

            &.show {
                color: var(--hh-primary-contrast);
                background-color: var(--bs-primary);

                &::after {
                    // White meatball menu
                    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M3 9.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z'/%3E%3C/svg%3E");
                    // For vertical dots (Kebab menu): background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z'/%3E%3C/svg%3E");
                }
            }
        }

        li.nav-item:has(> .dropdown-divider):last-of-type {
            display: none;
        }
    }

    .dropdown-toggle.dropdown-toggle-no-caret {
        &::after {
            display: none;
        }
    }

    // Nav-Tabs
    .nav-tabs {
        margin-bottom: 10px;

        &.tabs-center {
            li {
                float: none;
                display: inline-block;
            }
        }

        &.tabs-small {
            li > a {
                padding: 5px 7px;
            }
        }

        > li.nav-item {
            font-weight: 600;
            font-size: 12px;

            > a.nav-link {
                &,
                &[data-bs-toggle] {
                    margin-right: 2px;
                    color: var(--hh-text-color-main);
                }

                &.active,
                &:hover,
                &:focus {
                    border-bottom-color: transparent;
                    color: var(--hh-text-color-highlight);
                }
            }
        }
    }

    .list-group {
        a [class^="fa-"],
        a [class*=" fa-"] {
            display: inline-block;
            width: var(--hh-nav-icon-width);
        }
    }

    .tab-content .tab-pane {
        .mb-3 {
            margin-bottom: 5px;
        }
    }

    .nav .caret,
    .nav .caret:hover,
    .nav .caret:active {
        border-top-color: var(--hh-text-color-highlight);
        border-bottom-color: var(--hh-text-color-highlight);
        height: 6.928px;
    }

    .nav li.dropdown > a:hover .caret,
    .nav li.dropdown > a:active .caret {
        border-top-color: var(--hh-text-color-highlight);
        border-bottom-color: var(--hh-text-color-highlight);
    }

    .nav .open > a .caret,
    .nav .open > a:hover .caret,
    .nav .open > a:focus .caret {
        border-top-color: var(--hh-text-color-highlight);
        border-bottom-color: var(--hh-text-color-highlight);
    }

    .nav .open > a,
    .nav .open > a:hover,
    .nav .open > a:focus {
        border-color: #ededed;
    }

    .footer-nav {
        filter: opacity(.6);
        font-size: 12px;
        text-align: center;

        .select2-container {
            text-align: initial;
        }
    }

    @include media-breakpoint-down(lg) {
        .controls-header {
            text-align: left !important;
        }
    }

    // Widget "WallCreateContentMenu" / JS UI widget "content.form.CreateFormMenu":
    #contentFormMenu {
        display: none;

        &.menu-without-form a {
            border-radius: 4px;
        }

        .nav-tabs {
            margin-bottom: 0;
            border: none;
            float: right;

            > li.nav-item > a.nav-link {
                position: relative;

                &, &.active {
                    color: #7A7A7A;
                    background: var(--hh-background-color-main);
                    border-color: var(--hh-background-color-main);
                }

                &:hover, &.active {
                    z-index: 1;
                    color: var(--text-color-default);
                }
            }
        }

        &:after {
            content: " ";
            clear: both;
            display: block;
        }

        .content-create-menu-more {
            padding-right: 3px;

            > i {
                border-radius: 4px 4px 0 0;
                background: var(--hh-background-color-main);
                padding: 10px 15px 11px;
                font-size: 18px;

                &:hover {
                    color: #333;
                }
            }

            .dropdown-menu {
                background-color: var(--hh-background-color-main);
                border: 1px solid #D7D7D7;
                border-radius: 4px;

                li {
                    border-left-color: var(--hh-background-color-main);

                    &:hover, &.selected {
                        border-left-color: var(--bs-accent);
                        background-color: var(--hh-background-color-secondary) !important;
                    }

                    a {
                        color: var(--hh-text-color-default);
                    }
                }
            }
        }

        @include media-breakpoint-down(sm) {
            .nav-tabs {
                display: flex;
                width: 100%;

                > li.nav-item {
                    flex-grow: 1;
                    text-align: center;

                    &.content-create-menu-more {
                        flex-grow: 0.3;

                        > i.fa {
                            width: 100%;
                        }
                    }
                }
            }
        }
    }

    /**
     * Dark Mode styles
     */
    @if $enable-dark-mode {
        @include color-mode(dark, true) {
            .nav-pills.preferences .dropdown .dropdown-toggle::after {
                filter: invert(100%);
            }
        }
    }
}
