@editor-header-height: 48px;
@primary-color: #205dd9;

.ap-EditorHeader {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: @editor-header-height;
  line-height: @editor-header-height;
  min-width: 600px;
  background-color: #fff;
  box-shadow: 0 0 5px 0 rgba(22, 45, 61, 0.2);
  transition: 0.6s cubic-bezier(0.645, 0.045, 0.355, 1) top;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  z-index: 20;
  justify-content: space-between;

  .logo {
    // padding: 0 20px;
    margin: 0 10px;
    font-size: 20px;
    font-weight: normal;
    cursor: pointer;
    width: 122px;
    height: 100%;

    img {
      width: 100%;
      height: 100%;
      vertical-align: top;
    }
  }

  .control-button.group {
    border-color: transparent;
    position: relative;
    overflow: hidden;

    .control-button {
      padding: 0 20px;
      transition: all 0.2s;
      white-space: nowrap;
    }

    .control-button-publish {
      color: #fff;
      background: @primary-color;
    }

    .real-time-preview-button {
      padding: 0;
      transition: all 0.2s;
    }

    &.saving {
      border-color: #ececec;

      .control-button {
        border-color: transparent;
        transform: translateY(100%);
        opacity: 0;
      }
    }

    .save-btn {
      transition: all 0.2s;
      position: absolute;
      left: 0;
      right: 0;
      margin: auto;
      opacity: 0;
      transform: translateY(-100%);
      pointer-events: none;
      background-color: @primary-color;

      &.unsaved {
        opacity: 0;
      }

      &.updating,
      &.success,
      &.fail {
        opacity: 1;
        transform: translateY(0);
      }
    }
  }

  .ap-EditorHeader-navigation {
    overflow: hidden;
    white-space: nowrap;
    background-color: #eaf7ff;
    border-width: 0 1px;
    border-color: #ececec;
    width: 220px;
    padding: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;

    &.search {
      width: auto;
    }

    &:last-child > .control-button:last-child {
      border: 0;
    }

    .page-search-wrap {
      position: relative;
      margin: 0 20px;

      .page-search-btn {
        position: absolute;
        right: 10px;
        top: 5px;

        svg {
          fill: #b3c5d0;
        }
      }

      .page-search-clear {
        position: absolute;
        right: 40px;
        top: 16px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background-color: #91ccf1;
        line-height: 16px;

        svg {
          width: 16px;
          height: 16px;
          fill: #fff;
        }
      }
    }

    input {
      height: 34px;
      padding-right: 56px;
      padding-left: 15px;
      background-color: #fff;
      border: 1px solid #9dcdf7;
      color: #555;
      border-radius: 50px;
      margin: 0;
      line-height: 34px;
      display: inline-block;
    }
  }

  .page-navigation-name {
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ap-EditorHeader-devices {
    flex: 1;
    display: flex;
    justify-content: center;
  }

  .header-menu {
    padding: 0 15px;
  }

  .ap-EditorHeader-buttons {
    display: flex;
    cursor: pointer;

    .control-button {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 50px;
      height: 48px;
      border-left: 1px solid #ececec;

      &:last-child {
        border-right: 1px solid #ececec;
      }

      &.disable {
        cursor: not-allowed;

        svg {
          fill: #ccc;
        }

        color: #ccc;
      }

      svg {
        width: 20px;
        fill: #1d2d3c;
      }

      &.user-guide svg {
        fill: @primary-color;
      }
    }

    .control-label {
      white-space: nowrap;
      padding: 0 20px;
      display: inline-block;
    }

    .control-button-publish {
      background-color: @primary-color;
      color: #fff;
    }

    .control-button-preview {
      width: 210px;
    }

    .ap-EditorHeader-device.active {
      svg {
        fill: @primary-color;
        height: auto;
      }

      border-bottom: 2px solid @primary-color;
    }

    .ap-EditorHeader-device svg {
      width: 24px;
      height: auto;
    }

    .control-label.save-btn {
      border-radius: 50%;
      text-shadow: 0;
      transition: all 0.25s ease;
      margin: 0 20px;
      padding: 0;
      box-sizing: border-box;
      position: relative;

      i {
        font-style: normal;
      }

      &.unsaved {
        &::before {
          content: '';
          background: #f00;
          width: 3px;
          height: 3px;
          box-shadow: 0 0 3px #f00;
          border-radius: 50px;
          display: block;
          position: absolute;
          top: 0;
          bottom: 0;
          margin: auto;
          left: -8px;
        }
      }

      &.updating {
        border: 3px solid #bbb;
        height: 24px;
        width: 24px;
        border-left-color: @primary-color;
        animation: rotating 2s 0.25s linear infinite;

        &::before {
          display: none;
        }

        i {
          display: none;
        }
      }

      &.success {
        width: 24px;
        height: 24px;
        color: white;
        background: @primary-color;
        font-size: 12px;
        text-align: center;
        line-height: 24px;

        i {
          display: none;
        }

        &::after {
          font-family: 'FontAwesome';
          content: '\f00c';
        }
      }

      &.fail {
        width: 24px;
        height: 24px;
        color: white;
        background: #f44336;
        font-size: 12px;
        text-align: center;
        line-height: 24px;

        i {
          display: none;
        }

        &::after {
          font-family: 'FontAwesome';
          content: '\f00d';
        }
      }

      span.updateTip {
        position: absolute;
        left: 50%;
        top: 100%;
        background-color: #000;
        display: inline-block;
        color: #fff;
        font-size: 12px;
        line-height: 24px;
        transform: translateX(-50%);
        text-align: center;
        padding: 0 10px;
        border-radius: 4px;

        &::before {
          content: '';
          position: absolute;
          top: -6px;
          left: 50%;
          border: 6px solid transparent;
          border-bottom-color: #000;
          border-top: 0;
          margin: 0 0 -6px -6px;
        }
      }
    }
  }

  .generator-btn {
    height: 25px;
    line-height: 23px;
    border-radius: 12px;
    border: 1px solid @primary-color;
    color: @primary-color;
    cursor: pointer;
  }

  select {
    border: 1px solid @primary-color;
    line-height: 25px;
    margin-right: 5px;
    height: 25px;
    color: @primary-color;
    margin-left: 15px;
  }

  .exit-lightbox {
    background-color: @primary-color;
    color: #fff;
    position: relative;
    text-align: left;
    padding: 0 20px;
    font-weight: 500;
    width: 100%;

    .close {
      width: 25px;
      height: 25px;
      text-align: center;
      background-color: #fff;
      opacity: 0.7;
      border-radius: 50%;
      top: 10px;
      position: absolute;
      right: 20px;

      svg {
        width: 23px;
        fill: @primary-color;
      }
    }
  }
}

@keyframes rotating {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}
