@use "../old-variables" as old-vars;
@use "../media-queries" as *;

@mixin stark-header() {
  .stark-app-header {
    height: old-vars.$stark-header-size;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 110; /* z-index of sticky header in NG Table is 100. z-index of header should be bigger */
    overflow: visible;
    background-image: url(/assets/images/app-header.png);
    background-position: top right;
    background-repeat: no-repeat;

    h1 {
      font-size: 34px;
      line-height: 40px;
      margin: 0 0 16px;
      padding: 0;
      font-weight: 400;
    }

    .stark-app-bar {
      align-items: center;
      display: flex;
      justify-content: space-between;
      margin-top: -5px;
      position: relative;

      .stark-app-bar-content-left {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        width: 50%;

        > div {
          display: flex;
          justify-content: flex-start;

          &.stark-actions {
            margin-left: -10px;

            .stark-home-button {
              display: none;
            }
          }

          > * {
            margin-right: 3px;
          }
        }
      }

      .stark-app-bar-content-center {
        display: none;
        width: 0;
      }

      .stark-app-bar-content-right {
        display: flex;
        flex-direction: row-reverse;
        width: 50%;

        .stark-language-selector {
          width: 45px;
        }

        > div {
          align-items: center;
          display: flex;
          justify-content: flex-end;
          margin-bottom: 5px;

          &.stark-app-bar-content-right-actions-alt {
            position: fixed;
            right: 15px;
            bottom: 15px;
          }

          &:last-child {
            margin-bottom: 0;
          }

          > * {
            margin-left: 3px;
          }
        }
      }

      .stark-app-bar-page-title {
        top: 60px;
        left: 0;
        position: absolute;
        max-width: 100%;

        h1 {
          font-size: 24px;
          font-weight: 200;
          margin-bottom: 0;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
    }
  }

  @media #{$tablet-query} {
    .stark-app-header {
      height: old-vars.$stark-header-size-desktop;

      .stark-app-bar {
        align-items: flex-start;
        margin-top: 6px;

        .stark-app-bar-content-left {
          width: 33%;

          > div {
            &.stark-actions {
              .stark-home-button {
                display: block;
              }
            }
          }
        }

        .stark-app-bar-content-center {
          display: flex;
          justify-content: center;
          width: 34%;
        }

        .stark-app-bar-content-right {
          flex-direction: column;
          width: 33%;

          .stark-language-selector {
            width: 100px;
          }

          > div {
            &.stark-app-bar-content-right-center {
              margin-top: -10px;
            }

            &.stark-app-bar-content-right-actions-alt {
              margin-top: -10px;
              position: inherit;
            }
          }
        }

        .stark-app-bar-page-title {
          bottom: auto;
          max-width: 67%;
          top: 75px;

          h1 {
            font-size: 32px;
          }
        }
      }
    }
  }

  @media #{$desktop-screen-query} {
    .stark-app-header {
      .app-data {
        display: flex;
      }

      .app-data-alt {
        display: none;
      }
    }
  }

  @media #{$tablet-query} {
  }

  @media #{$desktop-query} {
    body:not(.full-curtain) {
      .stark-app-header {
        & h1 {
          font-size: 24px;
          font-weight: 500;
          line-height: 1.2;
          margin-bottom: 8px;
        }
      }
    }
  }

  .stark-header-container {
    padding: 0 15px;
  }

  @media screen and (max-width: 1230px) {
    //FIXME: Move to generic-search when it is implemented
    .stark-header-container,
    .stark-fixed-header-container .stark-generic-search .stark-generic-search-container .stark-header-container {
      box-sizing: border-box;
      padding-left: 15px;
      padding-right: 15px;
    }
  }
}
