@import '../style/mixins';
@import '../style/colors';

@keyframes witness-voting-color-change {
  0% {
    background: $dark-sky-blue;

    svg {
      fill: $white;
    }
  }
  25% {
    background: transparent;

    svg {
      fill: $dark-sky-blue;
    }
  }
  50% {
    background: $dark-sky-blue;
    svg {
      fill: $white;
    }
  }
  75% {
    background: transparent;
    svg {
      fill: $dark-sky-blue;
    }
  }
  100% {
    background: $dark-sky-blue;
    svg {
      fill: $white;
    }
  }
}

.btn-witness-vote {
  align-items: center;
  border: 1px solid $dark-sky-blue;
  border-radius: 50%;
  color: $dark-sky-blue;
  display: flex;
  height: 22px;
  justify-content: center;
  text-decoration: none;
  width: 22px;

  svg {
    height: 16px;
    width: 16px;
  }

  &:focus {
    text-decoration: none;
  }

  &:hover,
  &.voted {
    background-color: $dark-sky-blue;
    color: $white;
  }

  &.in-progress {
    animation: witness-voting-color-change 5s infinite;
    opacity: 0.5;
    pointer-events: none;
  }

  &.disabled {
    opacity: 0.5;
    pointer-events: none;
  }
}

.witnesses-page {
  overflow-y: auto;
  padding: 0 30px;

  .page-header {
    align-items: center;
    display: flex;
    height: 60px;
    justify-content: space-between;
    padding: 0 20px;

    @include themify(day) {
      border-bottom: 1px solid $white-four;
    }

    @include themify(night) {
      border-bottom: 1px solid lighten($dark-six, 4);
    }

    &.loading {
      border-bottom: 0;
    }

    .main-title {
      color: $dark-sky-blue;
      font-size: 22px;
      font-weight: 500;
    }

    .remaining {
      font-size: 16px;

      @include themify(day) {
        color: $steel-grey;
      }

      @include themify(night) {
        color: $powder-blue;
      }
    }
  }

  .proxy-active {
    @include themify(day) {
      color: $charcoal-grey;
    }

    @include themify(night) {
      color: $powder-blue;
    }

    .proxy-active-exp {
      font-size: 18px;
      margin: 20px 0 40px 0;
    }

    .clear-proxy-form {
      align-items: center;
      display: flex;
      .current-proxy {
        margin-right: 20px;
      }
    }
  }

  .witnesses-table {
    margin-bottom: 30px;

    .witness-column-title {
      padding-left: 60px;
    }

    .index-num {
      font-size: 16px;

      @include themify(day) {
        color: $silver;
      }
    }

    .witness-card {
      align-items: center;
      cursor: pointer;
      display: flex;

      .user-avatar {
        height: 40px !important;
        margin-right: 10px;
        width: 40px !important;
      }

      .username {
        cursor: pointer;
        font-weight: 700;

        @include themify(day) {
          color: $charcoal-grey;
        }
      }
    }

    .witness-link {
      color: $dark-sky-blue;
      font-size: 24px;
      font-weight: 700;

      &::after {
        // disable external link icon
        content: '' !important;
      }
    }

    .feed-price,
    .version-num {
      border-radius: 25px;
      color: $white;
      font-weight: 500;
      padding: 2px 10px;
    }

    .feed-price {
      background: $green3;
    }

    .version-num {
      background: $dark-sky-blue;
    }
  }

  .extra-funcs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 60px;

    .extra-witnesses {
      width: 300px;

      .witnesses-list {
        margin-top: 20px;
        .item {
          display: flex;
          justify-content: space-between;
          margin: 12px 0;
          width: 240px;

          .username {
            font-size: 16px;
            font-weight: 500;
            width: 180px;

            @include themify(day) {
              color: $charcoal-grey;
            }

            @include themify(night) {
              color: $powder-blue;
            }
          }

          .btn-submit {
            width: 40px;
          }
        }
      }
    }

    .proxy {
      width: 400px;
    }

    .extra-witnesses,
    .proxy {
      .explanation {
        font-size: 16px;
        margin-bottom: 10px;

        @include themify(day) {
          color: $steel-grey;
        }

        @include themify(night) {
          color: $powder-blue;
        }
      }

      .input-form {
        align-items: center;
        display: flex;
        justify-content: space-between;
        width: 240px;

        .txt-username {
          width: 180px;
        }

        .btn-submit {
          width: 40px;
        }
      }
    }
  }
}

.witnesses-page .witnesses-table {
  @include themify(night) {
    table {
      background: $dark-six;
    }
  }

  // Antd table overrides
  .ant-table-thead,
  .ant-table-tbody {
    th,
    td {
      border: 0;
      font-size: 16px;

      @include themify(day) {
        background: transparent !important;
        color: $steel-grey;
      }
    }

    th {
      font-weight: 700;
    }
  }

  .ant-table-row:nth-child(odd) {
    @include themify(day) {
      background: $white-three;
    }

    @include themify(night) {
      background: lighten($dark-six, 4);
    }
  }

  .ant-table-row {
    .first-col {
      border-top-left-radius: 10px;
      border-bottom-left-radius: 10px;
    }

    .last-col {
      border-top-right-radius: 10px;
      border-bottom-right-radius: 10px;
    }
  }
}
