@import '../variables';
@import '../theme-colors';

.navbar {
  background: var(--navbar-bg);
  margin-left: $sidebar-width-lg;
  font-family: $default-font-family;
  box-shadow: var(--navbar-box-shadow);
  transition: all $default-transition-duration $action-transition-timing-function;
  -moz-transition: all $default-transition-duration $action-transition-timing-function;
  -webkit-transition: all $default-transition-duration $action-transition-timing-function;

  .navbar-menu-wrapper {
    padding: 0 2rem;
    height: $navbar-height;
    color: $navbar-menu-color;
    width: calc(100% - #{$sidebar-width-lg});
    transition: width $default-transition-duration $action-transition-timing-function;
    -moz-transition: width $default-transition-duration $action-transition-timing-function;
    -webkit-transition: width $default-transition-duration $action-transition-timing-function;

    .navbar-brand {
      margin-right: 0;
      padding-right: 0.75rem;

      img {
        margin: auto;
        max-width: 32px;
        vertical-align: middle;
      }
    }

    .navbar-toggler {
      border: 0;
      align-self: center;
      height: $navbar-height;
      color: $light-navbar-link-color;

      svg {
        stroke-width: 1.6;
      }

      &:focus {
        outline: none;
      }
    }

    .count-indicator {
      position: relative;

      .count-symbol {
        position: absolute;
        top: 18px;
        right: 14px;
        width: 10px;
        height: 10px;
        border-radius: 100%;
        border: 1px solid $brand-color;
      }

      &:after {
        display: none;
      }
    }

    .navbar-centered-items {
      width: 25%;

      .navbar-search-form {
        width: 100%;

        .dropdown {
          transition: $default-transition-duration;

          .navbar-search {
            display: flex;
            align-items: center;
            position: relative;

            .form-control {
              background-color: transparent;
              border-radius: 20px !important;
              border-color: $brand-color !important;
              padding: 0.5rem 2.2rem 0.5rem 1rem !important;
            }

            .form-control-feedback {
              position: absolute;
              right: 0.7rem;
              border: 0;
              padding: 0;
              display: block;
              background-color: transparent;
              color: $forms-input-text-color;

              svg {
                width: 20px;
                height: 20px;
                stroke-width: 1.5;
              }
            }

            &[aria-expanded="true"] {
              .form-control {
                border-radius: 0 !important;
                height: $navbar-height - 10px !important;
                border-color: transparent !important;
              }
            }
          }

          .dropdown-menu {
            margin: 0;
            min-width: 100%;
            overflow-y: auto;
            max-height: 300px;
            border-radius: 0 0 0.5rem 0.5rem;
            box-shadow: var(--navbar-search-dropdown-shadow);
            border-top: 1px solid var(--default-border-color);
            @extend .dropdownAnimation;

            &::-webkit-scrollbar {
              width: 4px;
              height: 4px;
            }

            &::-webkit-scrollbar-track {
              background: var(--dropdown-menu-bg);
            }

            &::-webkit-scrollbar-thumb {
              border-radius: 2px;
              background: var(--scrollbar-thumb-color);
            }

            &:hover {
              &::-webkit-scrollbar-thumb {
                &:hover {
                  background-color: var(--scrollbar-thumb-hover-color);
                }
              }
            }
          }

          &.show {
            margin-top: 10px;
            border-radius: 0.5rem 0.5rem 0 0;
            box-shadow: var(--default-box-shadow);
          }
        }
      }
    }

    .navbar-nav {
      align-items: center;
      flex-direction: row;

      .nav-item {
        .nav-link {
          padding-left: 0.85rem;
          padding-right: 0.85rem;
          color: $brand-color;
          height: $navbar-height;
          display: inline-flex;
          align-items: center;
          justify-content: center;

          svg {
            stroke-width: 1.6;
          }
        }

        &.dropdown {
          .dropdown-toggle {
            &:after {
              display: none !important;
            }
          }

          .dropdown-menu {
            border: none;
            border-radius: $default-radius;

            &:before {
              width: 0;
              height: 0;
              content: '';
              z-index: 2;
              position: absolute;
              top: -7px;
              right: 15px;
              left: inherit;
              border-left: 7px solid transparent;
              border-right: 7px solid transparent;
              border-bottom: 7px solid var(--dropdown-menu-bg);
            }

            &.navbar-dropdown {
              margin-top: 0;
              min-width: 150px;
              padding: 0.8rem 0;
              position: absolute;

              .dropdown-item {
                display: flex;
                align-items: center;
                cursor: pointer;
                font-size: inherit;
                margin-bottom: 0;
                padding: 1rem 2rem 1rem 2rem;
              }
            }

            @extend .dropdownAnimation;
          }

          @media (max-width: 991px) {
            .navbar-dropdown {
              top: $navbar-height;
            }
          }
        }
      }
    }
  }
}

@media (max-width: 991px) {
  .navbar {
    margin-left: 0;
    flex-direction: row;

    .navbar-menu-wrapper {
      width: 100%;
    }
  }
}

@media (max-width: 767px) {
  .navbar {
    .navbar-menu-wrapper {
      padding-left: 20px;
      padding-right: 20px;
    }
  }
}

@media (max-width: 575px) {
  .navbar {
    .navbar-menu-wrapper {
      .navbar-toggler {
        padding-right: 0.5rem;
      }

      .navbar-centered-items {
        width: 30%;
      }

      .navbar-nav {
        .nav-item {
          .nav-link {
            padding-left: 0.5rem;
            padding-right: 0.5rem;
          }
        }
      }
    }
  }
}

// SCSS for RTL Layout
[dir="rtl"] {
  .navbar {
    .dropdown-menu {
      right: initial;
      left: 0;

      &:before {
        left: 15px !important;
        right: inherit !important;
      }
    }

    .navbar-menu-wrapper {
      position: absolute;
      top: 0;
      left: 0;
      background: var(--navbar-bg);
      box-shadow: var(--default-box-shadow);

      .navbar-nav {
        margin-right: auto !important;
        margin-left: 0 !important;

        .nav-profile-text {
          margin-right: 0;
          margin-left: 1.25rem;
        }
      }

      .navbar-toggler {
        margin-right: 0.5rem;
      }
    }
  }
}

[dir="rtl"][theme="dark"] {
  .navbar {
    .navbar-menu-wrapper {
      box-shadow: -5px 0px 10px rgba(0, 0, 0, 0.5);
    }
  }
}