// 
// _horizontal.scss
// 

.ishorizontal-topbar {
    display: none;
}

body[data-layout="horizontal"] {

    .ishorizontal-topbar {
        display: block;
    }

    .vertical-menu{
        display: none;
    }

    .ishorizontal-topbar{
        left: 0;
        box-shadow: none;
        border: 0;
        border-radius: 0;
        background-color: var(--#{$prefix}body-bg);
    }

    .noti-dot {
        box-shadow: 0 0 0 3px $header-bg;
    }

    .navbar-brand-box {
        display: block;
        width: auto;
        border: 0;
        background-color: transparent;
        box-shadow: none;
        position: relative;
        @media  (min-width: 992px){
            padding-left: 0;
            margin-right: 10px;
        }
    }

    .page-content {
        margin-top: $header-height;
        padding: calc(60px + #{$grid-gutter-width}) calc(#{$grid-gutter-width} / 2) 60px calc(#{$grid-gutter-width} / 2);
        @media (max-width: 991.98px) { 
            padding: $header-height calc(#{$grid-gutter-width} / 2) 60px calc(#{$grid-gutter-width} / 2);
            margin-top: $grid-gutter-width;
        }
    }

    .navbar-header{
        @media (min-width: 992px){
            padding-left: $grid-gutter-width;
            padding-right: $grid-gutter-width;
        }
    }

    .logo{
        margin-top: 0;
    }

    &[data-sidebar-size=sm]{
        .navbar-brand-box{
            width: auto !important;
        }
    }
}

.topnav {
    background: $header-bg;
    padding: 0 calc(#{$grid-gutter-width} / 2);
    z-index: 100;
    border-top: 1px solid $card-border-color;
    border-bottom: 1px solid $card-border-color;;
    box-shadow: $box-shadow;

    @media (min-width: 992px) {
        background: $topnav-bg;
    }
    
    
    .topnav-menu {
        margin: 0;
        padding: 0;
    }

    .navbar-nav {
        
        .nav-link {
            font-size: 14px;
            position: relative;
            padding: 1.2rem 1.3rem;
            color: $menu-item-color;
            font-weight: $font-weight-medium;
            font-family: $font-family-secondary;
            i{
                font-size: 1.2rem;
                margin-right: 5px;
                vertical-align: middle;
            }
            svg {
                height: 18px;
                width: 18px;
                fill: $menu-item-color;
                margin-right: 5px;
                margin-top: 1px;
            }
            &:focus, &:hover{
                color: $menu-item-active-color;
                background-color: transparent;
                svg {
                    fill: $menu-item-active-color;
                }
            }
        }
        
        .dropdown-item{
            color: $menu-item-color;
            background: transparent;
            font-weight: $font-weight-medium;
            font-size: 14px;
            transition: all .4s;
            font-family: $font-family-secondary;
            &:hover{
                color: $menu-item-active-color;
                margin-left: 5px;
            }
            &.active{
                color: $menu-item-active-color;
            }
        }
        
        .nav-item{
            .nav-link.active{
                color: $menu-item-active-color;
                svg {
                    color: $menu-item-active-color;
                }
            }
        }

        .dropdown{
            &.active{
              >a {
                    color: $menu-item-active-color;
                    background-color: transparent;
                    svg {
                        fill: $menu-item-active-color;
                    }
                }
            }
            .dropdown{
                &.active{
                    >a {
                          color: $menu-item-active-color;
                      }
                  }
            }
        }
    }

    .menu-title{
        padding: 12px 24px !important;
        @media (max-width: 991.98px) {
            padding: 12px 16px !important;
        }
    }
}

@include media-breakpoint-up(xl) {

    body[data-layout="horizontal"] {
        .container-fluid,
        .navbar-header {
            max-width: 85%;
        }
    }
}

@include media-breakpoint-up(lg) {
    .topnav {
        .navbar-nav {
            .nav-item {
                &:first-of-type {
                    .nav-link {
                        padding-left: 0;
                    }
                }
            }
        }

        .dropdown-item {
            padding: .5rem 1.5rem;
            min-width: 180px;
        }

        .dropdown {
            &.mega-dropdown{
                // position: static;
                .mega-dropdown-menu{
                    left: 0px;
                    right: auto;
                }
            }
            .dropdown-menu {
                margin-top: 0;
                border-radius: 0 0 $dropdown-border-radius $dropdown-border-radius;

                .arrow-down {
                    &::after {
                        right: 15px;
                        transform: rotate(-135deg) translateY(-50%);
                        position: absolute;
                    }
                }

                .dropdown {
                    .dropdown-menu {
                        position: absolute;
                        top: 0 !important;
                        left: 100%;
                        display: none;
                    }
                }
            }

            &:hover {
                >.dropdown-menu {
                    display: block;
                }
            }
        }

        .dropdown:hover>.dropdown-menu>.dropdown:hover>.dropdown-menu {
            display: block
        }
    }

    .navbar-toggle {
        display: none;
    }
}

.arrow-down {
    display: inline-block;

    &:after {
        border-color: initial;
        border-style: solid;
        border-width: 0 0 1px 1px;
        content: "";
        height: .4em;
        display: inline-block;
        right: 5px;
        top: 50%;
        margin-left: 10px;
        transform: rotate(-45deg) translateY(-50%);
        transform-origin: top;
        transition: all .3s ease-out;
        width: .4em;
    }
}


@include media-breakpoint-down(xl) {
    .topnav-menu {
        .navbar-nav {
            li {
                &:last-of-type {
                    .dropdown {
                        .dropdown-menu {
                            right: 100%;
                            left: auto;
                        }
                    }
                }
            }
        }
    }
}

@include media-breakpoint-down(lg) {

    .navbar-brand-box{
        .logo-dark {
            display: $display-block;
            span.logo-sm{
                display: $display-block;
            }
        }
    
        .logo-light {
            display: $display-none;
        }
    }
    
    .topnav {
        max-height: 360px;
        overflow-y: auto;
        padding: 0;
        .navbar-nav {
            .nav-link {
                padding: 0.75rem 1.1rem;
            }
        }

        .dropdown {
            .dropdown-menu {
                background-color: transparent;
                border: none;
                box-shadow: none;
                padding-left: 20px;
                &.dropdown-mega-menu-xl{
                    width: auto;
    
                    .row{
                        margin: 0px;
                    }
                }
            }

            .dropdown-item {
                position: relative;
                background-color: transparent;

                &:hover{
                    margin-left: 0;
                }

                &.active,
                &:active {
                    color: $primary;
                    margin-left: 0;
                }
            }
        }

        .arrow-down {
            &::after {
                right: 15px;
                position: absolute;
            }
        }
    }
}

body[data-layout="horizontal"][data-topbar="dark"] {
    .ishorizontal-topbar{
        background-color: $header-dark-bg;
    }

    .navbar-brand-box {
        .logo-dark {
            display: none;
        }
    
        .logo-light {
            display: block;

        }
    }

    .page-content {
        padding: calc(60px + #{$grid-gutter-width}) calc(#{$grid-gutter-width} / 2) 60px calc(#{$grid-gutter-width} / 2);
        @media (max-width: 991.98px) { 
            margin-top: $grid-gutter-width;
        }

    }
}



// Colored Topbar 

body[data-layout="horizontal"][data-topbar="colored"] {
    .ishorizontal-topbar{
        background-color: $primary;
        box-shadow: none;
    }

    .logo-dark {
        display: none;
    }

    .logo-light {
        display: block;
    }

    .app-search {
    
        .form-control {
            background-color: rgba($topbar-search-bg,0.07);
            color: $white;
        }
        span,
        input.form-control::-webkit-input-placeholder {
            color: rgba($white,0.5);
        }
    }
    .header-item {
        color: $header-dark-item-color;
    
        &:hover {
            color: $header-dark-item-color;
        }
    }

    .navbar-header {
        .dropdown .show {
            &.header-item{
                background-color: var(--#{$prefix}border-color);
            }
        }
    }

    .noti-icon {
        i {
            color: $header-dark-item-color;
        }
    }

    @include media-breakpoint-up(lg) {
        .topnav{
            background-color: $primary;
            .navbar-nav {
        
                .nav-link {
                    color: rgba($white, 0.6);
                    
                    &:focus, &:hover{
                        color: rgba($white, 0.9);
                    }
                }
        
                > .dropdown{
                    &.active{
                      >a {
                            color: rgba($white, 0.9) !important;
                        }
                    }
                }
            }
        }
    }
}


body[data-bs-theme="dark"] {

    &[data-layout="horizontal"] {
        .ishorizontal-topbar{
            background-color: $header-dark-bg;

        }
        .noti-icon {
            .noti-dot{
                box-shadow: var(--#{$prefix}box-shadow);
            }
        }

        &[data-topbar="light"] {

            .page-content {
                padding: calc(60px + #{$grid-gutter-width}) calc(#{$grid-gutter-width} / 2) 60px calc(#{$grid-gutter-width} / 2);
            }

            .logo-dark {
                display: block;
            }
        
            .logo-light {
                display: none;
            }
        }

    }

    .topnav {
        background-color: lighten($header-dark-bg,3%);
        border-color: var(--#{$prefix}border-color);
        box-shadow: var(--#{$prefix}box-shadow);

        .navbar-nav{
            .nav-link{
                color: $menu-dark-item-color;

                svg {
                    fill: $menu-dark-item-color;
                }

                &:focus, &:hover{
                    color: $menu-dark-item-active-color;
                    background-color: transparent;
                    svg {
                        fill: $menu-dark-item-active-color;
                    }
                }
            }

            .dropdown-item{
                color: $menu-dark-item-color;
                background-color: transparent;

                &.active, &:hover{
                    color: $menu-dark-item-active-color;
                }
            }

            .nav-item{
                .nav-link.active{
                    color: $menu-dark-item-active-color;
                    svg {
                        color: $menu-dark-item-active-color;
                    }
                }
            }

            .dropdown{
                &.active{
                  >a {
                        color: $menu-dark-item-active-color;
                        background-color: transparent;
                        svg {
                            fill: $menu-dark-item-active-color;
                        }
                    }
                }
            }
        }

        .menu-title{
            color: rgba($menu-dark-item-color,0.6);
        }
    }
}

// layout bordered

body[data-bs-theme="bordered"] {
    .topnav{
        box-shadow: none;
    }
}

// topbar hidden

body[data-topbar="hidden"][data-layout="horizontal"] {
    .ishorizontal-topbar{
        .navbar-header{
            display: none !important;
        }  
   }
   .page-content {
    transition: all 0.3s;
    margin-top: calc(#{$header-height} - 15px);
    padding:  $grid-gutter-width calc(#{$grid-gutter-width} / 2) $footer-height calc(#{$grid-gutter-width} / 2);
    @media (max-width: 991.98px) { 
        margin-top: 0;
        padding: $grid-gutter-width calc(#{$grid-gutter-width} / 2) 60px calc(#{$grid-gutter-width} / 2);
    }

   }
   
}


