/*#############################################################################
# HEADER
#############################################################################*/

header.app-header {
  border-bottom: 1px solid #E9EAEA;
  display: grid;
  grid-template-columns: 180px 1fr minmax(180px, auto);
  grid-template-rows: 50px;

  .progress-bar & {
    grid-template-rows: 50px 10px;
  }

  h1.sempli-logo {
    grid-column: 1;
    grid-row: 1;
    width: 130px;
    margin: 0;
    border-right: 1px solid #E9EAEA;

    a {
      display: block;
      background: url("/assets/swl/interface/sempli-logo.svg") no-repeat 50% 50%;
      background-size: 87px 22px;
      height: 0;
      width: 130px;
      padding-top: 50px;
      margin: 0;
      overflow: hidden;
    }
  }

  .header-step-title {
    grid-column: 2;
    grid-row: 1;
    height: 50px;
    padding: 0 20px 0 32px;
    @include pie-clearfix;

    > * {
      height: 50px;
      line-height: 50px;
      margin: 0;
      @include float(left);
    }

    h2.header-block-name {
      color: #434448;
      font-size: 18px;
      font-weight: 400;
    }

    h3.header-step-name {
      color: #AFB3C0;
      font-size: 16px;
      font-weight: 400;
      margin-left: 15px;
      padding-left: 20px;
      position: relative;

      &::before {
        content: "";
        display: block;
        background-color: #AFB3C0;
        width: 5px;
        height: 5px;
        position: absolute;
        top: 50%;
        left: 0;
        @include border-radius(100%);
        @include transform(translateY(-50%));
      }
    }
  }

  .header-save-progress {
    grid-column: 3;
    grid-row: 1;
    height: 50px;
    padding: 0 20px;

    a.save-progress {
      display: block;
      height: 50px;
      line-height: 50px;
      margin: 0;
      position: relative;

      span.tooltip {
        display: none;
        background: $color-primary;
        color: #fff;
        font-size: rem-calc(14px);
        line-height: 20px;
        width: 320px;
        padding: 10px 20px;
        position: absolute;
        right: 0;
        z-index: 1;
        @include border-radius(6px);
        @include transform(translateY(-10px));
        @include box-shadow(-2px 4px 10px 0 rgba(black, 0.1));

        &::before {
          content: "";
          display: block;
          width: 0;
          height: 0;
          border-style: solid;
          border-width: 0 10px 10px 10px;
          border-color: transparent transparent $color-primary transparent;
          position: absolute;
          top: 0;
          right: 60px;
          @include transform(translateY(-100%));
        }
      }

      &:hover,
      &.tooltip-active {
        span.tooltip {
          display: block;
        }
      }
    }
  }

  .header-nav {
    grid-column: 2;
    grid-row: 1;
    height: 50px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;

    @include responsive-max($breakpoint-medium) {
      display: none;
    }

    a.nav-link {
      display: block;
      color: $color-secondary;
      font-weight: 900;
      height: 50px;
      line-height: 50px;
      margin-right: 35px;

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

      &:hover {
        color: $color-text;
      }

      // Active State
      &.active {
        color: $color-text;
        border-bottom: 2px solid $color-text;
      }
    }

    > div {
      margin-right: 30px;
      position: relative;
      @include float(left);

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

      // Dropdown Container
      ul.dropdown-container {
        background: #fff;
        list-style: none;
        margin: 0;
        padding: 0;
        padding: 15px 25px;
        visibility: hidden;
        opacity: 0;
        z-index: 1;
        position: absolute;
        top: 0;
        left: 0;
        @include border-radius(5px);
        @include box-shadow(
          2px 2px 25px 0 rgba(black, 0.1),
          0 0 0 1px rgba(black,0.015)
        );
        @include transform(translate(0, 50px));
        @include transition(
          opacity 0.3s cubic-bezier(.7, 0, .175, 1) 0s,
          transform 0.3s cubic-bezier(.7, 0, .175, 1) 0s
        );

        &::after {
          content: "";
          display: block;
          border-style: solid;
          border-width: 0 8px 8px 8px;
          border-color: transparent transparent #ffffff transparent;
          width: 0;
          height: 0;
          position: absolute;
          top: 0;
          left: 20px;
          z-index: 2;
          @include transform(translateY(-100%));
        }

        &::before {
          content: "";
          display: block;
          border-style: solid;
          border-width: 0 9px 9px 9px;
          border-color: transparent transparent rgba(black,0.025) transparent;
          width: 0;
          height: 0;
          position: absolute;
          top: 0;
          left: 19px;
          z-index: 1;
          @include transform(translateY(-100%));
        }

        li {
          line-height: 30px;
          margin-bottom: 10px;

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

          // LINK ITEM WITH ICON
          a.link-item {
            &.with-icon {
              display: grid;
              grid-template-columns: 40px 1fr;
              grid-template-rows: 20px 1fr;
              grid-column-gap: 20px;
              grid-row-gap: 5px;
              height: auto;
              padding: 15px;
              line-height: initial;
              white-space: normal;
              @include border-radius(5px);

              img.link-item-icon,
              picture.link-item-icon {
                grid-column: 1;
                grid-row: 1 / 3;
                align-self: center;
                display: block;
                width: 40px;
              }

              span.link-item-label {
                grid-column: 2;
                grid-row: 1;
                color: $color-text;
                font-weight: 900;
              }

              span.link-item-description {
                grid-column: 2;
                grid-row: 2;
                font-size: rem-calc(14px);
              }

              &.active {
                background: $default-color-hover;
              }

              &:hover {
                background: $default-color-hover;
              }
            }
          }

          // Coming Soon / Disabled
          &.disabled {
            a.link-item {
              &.with-icon {
                img.link-item-icon {
                  opacity: 0.5;
                  @include filter(grayscale(100%));
                }

                span.link-item-label {
                  color: $color-secondary;
                }

                span.link-item-description {
                  color: $color-secondary;
                }
              }
            }
          }
        }

        // Dropdown Specific
        &.products {
          width: 480px;

          & > li {
            // margin-bottom: 25px;

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

      // With Dropdown State
      &.with-dropdown {
        &:hover {
          ul.dropdown-container {
            visibility: visible;
            opacity: 1;
            z-index: 2;
            @include transform(translate(0, 55px));
          }
        }

        > .nav-link {
          padding-right: 15px;
          margin-right: 0 !important;
          &::after {
            content: "";
            display: block;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 5px 4px 0 4px;
            border-color: $color-secondary-dark transparent transparent transparent;
            position: absolute;
            top: 50%;
            right: 0;
            @include transform(translateY(-50%));
          }

          &:hover {
            &::after {
              border-width: 0 4px 5px 4px;
              border-color: transparent transparent $color-text transparent;
            }
          }
        }
      }
    }
  }

  a.link-item {
    display: block;
    color: $color-secondary-dark;
    font-weight: 400;
    line-height: 40px;
    height: 40px;
    white-space: nowrap;

    &:hover {
      color: $color-text;
    }
  }


  .mobile-nav {
    grid-column: 2;
    grid-row: 1;
    height: 50px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    nav {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
    }

    a.nav-link, .nav-title {
      display: flex;
      justify-content: center;
      color: $color-secondary;
      font-size: 25px;
      font-weight: 900;
      height: 50px;
      line-height: 50px;

      // Active State
      &.active {
        color: $color-text;
        border-bottom: none;
      }
    }

    @include responsive($breakpoint-medium) {
      display: none;
    }
  }

  .mobile-nav, .header-nav {
    ul.links-group , .dropdown-container {
      li {
        a.link-item {
          span.coming-soon {
            background-color: $color-primary;
            color: #ffffff;
            font-size: rem-calc(10px);
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-left: 3px;
            padding: 3px 8px;
            @include border-radius(3px);
          }
        }

        // Coming Soon / Disabled
        &.disabled {
          a.link-item {
            span.coming-soon {
              background-color: #00C8E1;
            }

            &:hover {
              background: transparent;
              cursor: no-drop;
            }
          }
        }
      }
    }
  }

  .header-sign-in-button {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 100%;
    gap: 25px;
    margin-right: 10px;

    .button {
      margin: 0;
    }

    @include responsive-max($breakpoint-medium) {
      display: none;
    }
  }

  .header-account {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 50px;
    padding: 0 20px;
    grid-gap: 20px;

    .option-separator {
      border-right: 1px solid #E9EAEA;
      height: 50%;
    }

    .profile {
      &:hover {
        .profile-photo {
          content:url("/assets/swl/interface/icons/profile-user-active-icon.svg");
        }
      }

      &.active {
        .profile-photo {
          content:url("/assets/swl/interface/icons/profile-user-active-icon.svg");
        }
      }
    }


    @include responsive-max($breakpoint-medium) {
      display: none;
    }

    img.profile-photo {
      display: block;
      width: 34px;
      height: 34px;
      @include border-radius(100%);
    }
  }

  .progress-bar {
    grid-column: 1/4;
    grid-row: 2;
    border: none;
    border-top: 1px solid #E9EAEA;
    height: 10px;
    margin: 0;
    @include border-radius(0);

    .progress {
      height: 9px;
      @include border-radius(0);
      @include border-right-radius(4.5px);
    }
  }

  @include responsive($breakpoint-medium) {
    grid-template-rows: 70px;

    .progress-bar & {
      grid-template-rows: 70px 10px;
    }

    h1.sempli-logo {
      width: 180px;

      a {
        background-size: 119px 30px;
        width: 180px;
        padding-top: 70px;
      }
    }

    .header-step-title {
      height: 70px;

      > * {
        height: 70px;
        line-height: 70px;
      }
    }

    .header-save-progress {
      height: 70px;

      a.save-progress {
        height: 70px;
        line-height: 70px;
      }
    }

    .header-nav {
      height: 70px;

      a.nav-link {
        height: 70px;
        line-height: 70px;
      }
    }

    .header-account {
      height: 70px;
    }
  }

  @include responsive-max($breakpoint-small) {
    .header-step-title {
      display: none;
    }
  }

  @include responsive-max($breakpoint-medium) {
    grid-template-columns: auto;
  }

  // Payment Header
  &.payment, &.empty-header {
    grid-template-columns: 1fr;

    h1.sempli-logo {
      border-right: none;
      margin: 0 auto;
    }
  }

  input#burger {
    opacity: 0;
  }

  input#burger + label {
    position: absolute;
    top: 16px;
    right: 20px;
    height: 20px;
    width: 15px;
    z-index: 1002;

    span {
      position: absolute;
      width: 100%;
      height: 2px;
      top: 50%;
      margin-top: -1px;
      left: 0;
      display: block;
      background: $color-secondary;
      transition: 0.5s;
      @include border-radius(2px);

      &:nth-child(2) {
        @include transform(translateY(-50%));
      }

      &:first-child {
        top: 3px;
      }

      &:last-child {
        top: 15px;
      }
    }
  }

  label:hover {
    cursor: pointer;
  }

  input#burger:checked + label {
    span {
      opacity: 0;
      top: 50%;
    }
    span:first-child {
      opacity: 1;
      transform: rotate(405deg);
    }
    span:last-child {
      opacity: 1;
      transform: rotate(-405deg);
    }
  }

  input#burger ~ nav {
    background: white;
    width: 100%;
    height: 50px;
    transition: 0.5s;
    transition-delay: 0.5s;
    overflow: hidden;
    opacity: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;

    .links-group-wrapper {
      margin-top: 15px;
      &:last-child {
        border: none;
        padding-bottom: 0;
      }
    }

    .nav-title {
      text-align: center;
      opacity: 0;
      transition: 0.5s;
      transition-delay: 0s;
      margin: 0 0 10px;
    }

    ul {
      text-align: center;
      list-style: none;
      margin: 0;
      padding: 0;

      > li {
        opacity: 0;
        transition: 0.5s;
        transition-delay: 0s;

        a.button, button.button {
          display: block;
          margin: 10px 20px 0;
        }

        a.link-item {
          line-height: 30px;
          height: 30px;
        }
      }
    }
  }

  input#burger:checked ~ nav {
    height: 100%;
    opacity: 1;
    transition-delay: 0s;
    .nav-title {
      opacity: 1;
      transition-delay: 0.5s;
    }
    ul {
      > li {
        opacity: 1;
        transition-delay: 0.75s;
      }
    }
  }
}
