//
// Layout Header
// --------------------------------------------------

// animate `app-header` on sidebar-left opened
.no-csstransforms3d.sidebar-open-ltr {
  #app-header.navbar {
    left: @sidebar-left-width;
  }
}
.csstransforms3d.sidebar-open-rtl {
  #app-header.navbar {
    .translate3d(-@sidebar-right-width, 0, 0);
  }
}
.no-csstransforms3d.sidebar-open-rtl {
  #app-header.navbar {
    left: -@sidebar-right-width;
    right: @sidebar-right-width;
  }
}

// navbar as header
#app-header.navbar {
  .transition(all .3s ease);
  float: left;
  z-index: @header-zindex;
  min-height: @header-height;
  border-width: 0;
  border-radius: 0;
  margin-bottom: 0;
  .background-blur();

  // fixed header
  .header-fixed & {
    position: fixed;
    right: 0;
    left: 0;
    top: 0;
    border-bottom: 1px solid var(--border-subtle);

    // Add top padding to `app-content` if header is fixed
    ~ #app-content {
      > .content-body {
        padding-top: @header-height;
      }
    }
  }

  // reset bootstrap `navbar-nav` style inside `navbar-nocollapse`
  .navbar-nocollapse {
    .clearfix();

    // navbar-header
    // -------------------------
    .navbar-header {
      height: @header-height;

      // navbar-toggle
      .navbar-toggle {
        display: inline-block;
        float: left;
        margin: 0;
        border-width: 0;
        padding: ((@header-height - 12) / 2) 15px;

        .icon-bar {
          margin-left: auto;
          margin-right: auto;
          height: 2px;
          width: 18px;
          border-radius: 0;
          + .icon-bar {
            margin-top: 3px;
          }
        }
      }
    }

    // navbar-nav
    // -------------------------
    .navbar-nav {
      //position: relative;
      float: left;
      margin: 0;
      display: flex;
      align-items: center;

      > .mautic-brand > .mautic-logo-text {
        opacity: 1;
        margin-left: 3px;
        position: absolute;
        .transition(~"opacity .3s ease .1s, margin-left 0s ease .2s");
        .transition(~"opacity .3s ease .1s, margin-left 0s ease .2s");
      }
      > .mautic-brand {
        .transition(padding-left .3s ease);
      }

      > li {
        float: left;

        // `navbar-nav` anchor
        > a {
          color: var(--text-primary);
          line-height: @header-height;
          padding-top: 0;
          padding-bottom: 0;
          .clearfix();

          // lineicon reset
          .sli {
            top: 1px;
          }

          // badge & label
          // -------------------------
          > .badge,
          > .label {
            position: absolute;
            z-index: 1;
            top: ((@header-height / 2) - 18);
            right: 8px;
            font-size: 10px;
            padding: 0 4px;
            line-height: 16px;
            height: 16px;
            min-width: 16px;
            border-radius: 16px;
            .box-shadow(0 0 0 2px @header-bg);

            // aligment
            // -------------------------
            &.pull-right {
              left: auto;
              right: 4px;
            }
          }

          // bullet
          // -------------------------
          > .bullet {
            position: absolute;
            z-index: 1;
            top: ((@header-height / 2) - 12);
            right: 15px;
            .box-shadow(0 0 0 2px @header-bg);

            // aligment
            // -------------------------
            &.pull-right {
              left: auto;
              right: 4px;
            }
          }

          // interaction
          // -------------------------
          &:hover {
            color: var(--text-primary);
            background-color: transparent;
          }
          &:active,
          &:focus,
          &.active {
            color: var(--text-primary);
            background-color: var(--background-hover);
          }
        }
      }

      // avatar
          // -------------------------
          img,
          .img-wrapper {
            border-radius: 100%;
            width: 28px;
            min-width: 28px;
            aspect-ratio: 1/1;
          }

          .dropdown-menu-user {
            .text { line-height: 14px; }
          }

      // dropdown custom
      // -------------------------
      .dropdown-custom {
        position: static;

        // dropdown
        // -------------------------
        .dropdown-menu {
          width: 320px;
          overflow: hidden;

          // reset custom-dropdown to strecth on viewport <= 480
          // -------------------------
          @media (max-width: 480px) {
            width: auto !important;
            left: 15px !important;
            right: 15px !important;
          }
        }
      }

      // open state
      .open {
        // reset default bootstrap `navbar-nav` `dropdown-menu`
        .dropdown-menu {
          background-color: var(--layer);
          position: absolute;
          top: 100%;
          margin-top: 5px;
          left: 15px;
          float: left;
          border: 1px solid @dropdown-fallback-border; // IE8 fallback
          border: 1px solid @dropdown-border;
          border-top-left-radius: var(--border-radius-md);
          border-top-right-radius: var(--border-radius-md);
          .box-shadow(0 3px 6px rgba(0,0,0,.06));
        }

        // `navbar-nav` anchor
        > a {
          color: var(--text-primary);
          background-color: var(--background-hover);

          // interaction
          &:hover,
          &:focus {
            color: var(--text-primary);
            background-color: var(--background-hover);
          }

          // badge & bullet
          // -------------------------
          > .badge,
          > .bullet,
          > .label {
            .box-shadow(0 0 0 2px var(--background-hover));
          }
        }
      }
    }

    // navbar-form
    // -------------------------
    .navbar-form {
      background-color: @header-bg;
      padding-top: 0;
      padding-bottom: 0;
      margin: 0;

      // `navbar-form` mobile style
      position: absolute;
      z-index: @zindex-dropdown;
      top: -100%;
      left: 0;
      right: 0;
      border-width: 0;
      .box-shadow(none);
      .transition(top .3s ease);

      // open state
      &.open {
        top: 0;
        .transition(top .3s ease);
      }

      // `form-group` reset
      .form-group,
      .input-group {
        margin-top: ((@header-height - @input-height-base) / 2);
        margin-bottom: ((@header-height - @input-height-base) / 2);

        // reset fontawesome color
        .fa { color: var(--text-primary); }
      }

      // `form-control` reset
      .form-control {
        background-color: var(--background-hover);
        border-color: transparent;
        .placeholder(var(--text-placeholder));
      }
    }

    // navbar alignment
    // -------------------------
    .navbar-left {
      float: left !important;

      // dropdown alignment
      .open .dropdown-menu {
        left: 0;
        right: auto;
      }
      // dropdown-custom alignment
      .open.dropdown-custom .dropdown-menu {
        left: 15px;
        right: auto;
      }
    }
    .navbar-right {
      float: right !important;

      .open > a:after {
        z-index: 1003;
        bottom: -7px;
        margin-left: -8px;
        border-width: 0 8px 8px;
        border-color: transparent transparent var(--layer);
        position: absolute;
        content: "";
        left: 50%;
        width: 0;
        height: 0;
        border-style: solid;
      }

      .open > a:before {
        z-index: 1002;
        bottom: -6px;
        margin-left: -9px;
        border-width: 0 9px 9px;
        border-color: transparent transparent @dropdown-border;
        position: absolute;
        content: "";
        left: 50%;
        width: 0;
        height: 0;
        border-style: solid;
      }

      // dropdown alignment
      .open .dropdown-menu {
        left: auto;
        right: 0;
      }
      // dropdown-custom alignment
      .open.dropdown-custom .dropdown-menu {
        left: auto;
        right: 15px;
      }
    }
  }
}

// breakpoint screen-sm and up
// -------------------------
@media (min-width: @screen-sm-min) {
  #app-header.navbar {
    // fixed header
    .header-fixed & {
      // Add top padding to `app-sidebar` if header is fixed
      ~ .app-sidebar {
        padding-top: @header-height;
      }
    }

    .navbar-nocollapse {
      // navbar-form
      // -------------------------
      .navbar-form {
        // `navbar-form` non mobile style
        position: static;
        float: left;
      }
    }
  }
}