@import '~antd/es/style/themes/default.less';

@border-color: #e6e6e6;
@card-content-padding-top: 30px;
@card-content-padding-left: 30px;

.pro-table-card {
  position: relative;
  background-color: #fff;

  .pro-table-card-setting-item {
    color: rgba(0, 0, 0, 0.75);
    font-size: 16px;
    cursor: pointer;

    &:hover {
      color: @primary-color-hover;
    }

    &.active {
      color: @primary-color-active;
    }
  }

  .pro-table-card-items {
    display: grid;
    grid-gap: 26px;
    padding-bottom: 38px;

    .pro-table-card-item {
      display: flex;

      .card-item-avatar {
        margin-right: 16px;
      }

      .card-item-body {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        width: 0;

        .card-item-header {
          display: flex;
          width: calc(100% - 86px);
          margin-bottom: 12px;

          .card-item-header-name {
            font-weight: bold;
            font-size: 16px;
          }
        }

        .card-item-content-flex {
          display: flex;
          flex-wrap: wrap;
          gap: 12px;

          .flex-auto {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            width: 0;
          }

          .flex-button {
            display: flex;
            flex: 0 0 50px;
            align-items: center;
            justify-content: center;
            height: 50px;
            color: @primary-color;
            border: 1px solid @primary-color-active;
            cursor: pointer;
          }

          label {
            color: rgba(#000, 0.75);
            font-size: 12px;
          }

          .ellipsis {
            font-weight: bold;
            font-size: 14px;
          }
        }

        .card-item-content {
          display: flex;
          flex-wrap: wrap;

          > div {
            width: 50%;

            &:nth-child(even) {
              width: calc(50% - 12px);
              margin-left: 12px;
            }
          }

          label {
            color: rgba(#000, 0.75);
            font-size: 12px;
          }

          .ellipsis {
            max-width: 70%;
            font-weight: bold;
            font-size: 14px;
          }
        }
      }
    }
  }

  .pro-table-card-pagination {
    position: absolute;
    right: 24px;
    bottom: 24px;

    > .ant-pagination-item {
      display: none;
    }
  }

  .mask-loading {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 99;
    display: none;
    width: 100%;
    height: 100%;

    &.show {
      display: block;
    }
  }
}

.iot-card {
  width: 100%;
  background-color: #fff;

  .checked-icon {
    position: absolute;
    right: -22px;
    bottom: -22px;
    z-index: 2;
    display: none;
    width: 44px;
    height: 44px;
    color: #fff;
    background-color: red;
    background-color: #2f54eb;
    transform: rotate(-45deg);

    > div {
      position: relative;
      height: 100%;
      transform: rotate(45deg);

      > span {
        position: absolute;
        top: 6px;
        left: 6px;
        font-size: 12px;
      }
    }
  }

  &.hover {
    box-shadow: 0 0 24px rgba(#000, 0.1);
  }

  .card-warp {
    position: relative;
    border: 1px solid @border-color;

    .card-content {
      position: relative;
      padding: @card-content-padding-top 12px 16px @card-content-padding-left;
      overflow: hidden;

      &::before {
        position: absolute;
        top: 0;
        left: @card-content-padding-left + 10px;
        display: block;
        width: 15%;
        min-width: 64px;
        height: 2px;
        background-image: url('/images/rectangle.png');
        background-repeat: no-repeat;
        background-size: 100% 100%;
        content: ' ';
      }

      .card-state {
        position: absolute;
        top: @card-content-padding-top;
        right: -12px;
        display: flex;
        justify-content: center;
        width: 100px;
        padding: 2px 0;
        background-color: rgba(#5995f5, 0.15);
        transform: skewX(45deg);

        &.success {
          background-color: @success-color-deprecated-bg;
        }

        &.warning {
          background-color: rgba(#ff9000, 0.1);
        }

        &.error {
          background-color: rgba(#e50012, 0.1);
        }

        .card-state-content {
          transform: skewX(-45deg);
        }
      }
    }

    .card-mask {
      position: absolute;
      top: 0;
      left: 0;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      color: #fff;
      background-color: rgba(#000, 0);
      visibility: hidden;
      cursor: pointer;
      transition: all 0.3s;

      > div {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        padding: 0 !important;
      }

      &.show {
        background-color: rgba(#000, 0.5);
        visibility: visible;
      }
    }
  }

  &.item-active {
    position: relative;
    color: #2f54eb;

    .checked-icon {
      display: block;
    }

    .card-warp {
      border: 1px solid #2f54eb;
    }
  }

  .card-tools {
    display: flex;
    margin-top: 8px;

    .card-button {
      display: flex;
      flex-grow: 1;

      > span,
      & button {
        width: 100%;
        border-radius: 0;
      }

      button {
        background: #f6f6f6;
        border: 1px solid #e6e6e6;

        &:hover {
          background-color: @primary-color-hover;
          border-color: @primary-color-hover;

          span {
            color: #fff !important;
          }
        }

        &:active {
          background-color: @primary-color-active;
          border-color: @primary-color-active;

          span {
            color: #fff !important;
          }
        }
      }

      &:not(:last-child) {
        margin-right: 8px;
      }

      &.delete {
        flex-basis: 60px;
        flex-grow: 0;

        button {
          background: @error-color-deprecated-bg;
          border: 1px solid @error-color-outline;

          span {
            color: @error-color !important;
          }

          &:hover {
            background-color: @error-color-hover;

            span {
              color: #fff !important;
            }
          }

          &:active {
            background-color: @error-color-active;

            span {
              color: #fff !important;
            }
          }
        }
      }

      button[disabled] {
        background: @disabled-bg;
        border-color: @disabled-color;

        span {
          color: @disabled-color !important;
        }

        &:hover {
          background-color: @disabled-active-bg;
        }

        &:active {
          background-color: @disabled-active-bg;
        }
      }
    }
  }
}
