@import '~@alife/theme-cnwms-operate/variables.scss';

$card-width: calc(100vw * 0.25);
$card-min-height: calc(#{$card-width} * 0.7 / 4);
$card-max-height: calc(#{$card-width} * 0.7);

@mixin op-card-info($typeColor) {
  width: 100%;
  background-color: #fff;
  padding: 8px;
  .op-card-info-title {
    font-size: 24px;
    span {
      margin-left: 4px;
    }
  }
  .op-card-info-tags {
    display: flex;
    flex-wrap: wrap;
    padding: 8px 0;
    .op-card-info-tag {
      background-color: $typeColor;
      border-radius: 16px;
      margin: 4px;
      padding: 4px;
    }
  }
}

.op-card + .op-card {
  margin-top: 12px;
}
.op-card {
  position: relative;
  padding: 12px;
  border-radius: 16px;
  background-color: #ffffff;
  min-height: $card-min-height;
  &-active {
    background-color: $color-link-1 !important;
    div {
      color: white;
    }
  }
  &-disabled {
    div {
      color: rgba($color-text1-5, 0.5);
    }
  }
  &-max-height {
    display: flex;
    flex-direction: column;
    max-height: $card-max-height;
    .op-card-scroll {
      flex: 1;
      overflow-y: auto;
    }
  }
  &-title {
    position: relative;
    line-height: 24px;
    font-size: 20px;
    color: $color-text1-3;
    .operate-tag {
      position: absolute;
      top: -4px;
      right: 0;
    }
  }
  &-content {
    line-height: 1.167;
    font-weight: bold;
    color: $color-text1-5;
    word-break: break-all;
  }
  // 图片/条码
  &-image {
    display: flex;
    flex-direction: column;
    height: $card-max-height;
    .op-card-content {
      font-size: 24px;
    }
    * + .op-card-image-content {
      margin-top: 8px;
    }
    * + .op-card-barcode-content {
      flex: 1 1 0;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 8px;
      text-align: center;
    }
    &-content {
      flex: 1 1 0;
      display: flex;
      overflow: hidden;
      .image-item + .image-item {
        margin-left: 12px;
      }
      .image-item {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
        overflow: hidden;
        border-radius: 16px;
        &.fit-contain-in {
          img {
            max-width: 100%;
            max-height: 100%;
          }
        }
        &.fit-contain-out {
          img {
            object-fit: cover;
            min-width: 100%;
            min-height: 100%;
          }
        }
        &.fit-width {
          img {
            width: 100%;
          }
        }
        &.fit-height {
          img {
            height: 100%;
          }
        }
        img {
          border-radius: 16px;
        }
      }
    }
  }
  &-action {
    position: absolute;
    top: 10px;
    right: 16px;
    cursor: pointer;
  }
  &-list {
    * + &-content {
      margin-top: 6px;
    }
    &-content {
      * + .op-card-list-item {
        margin-top: 8px;
      }
      .op-card-list-item {
        line-height: 24px;
        font-size: 20px;
        .item-label {
          color: $color-text1-3;
        }
        .item-value {
          color: $color-text1-5;
        }
        &.label-align-left {
          display: flex;
          .item-label {
            text-align: right;
          }
          .item-value {
            flex: 1 1 0;
            margin-left: 16px;
          }
        }
      }
    }
  }
  &-info {
    &.op-card-info-success {
      @include op-card-info($color-success-1);
      .op-card-info-tag {
        color: #fff;
      }
    }
    &.op-card-info-error {
      @include op-card-info($color-error-1);
      .op-card-info-tag {
        color: #fff;
      }
    }
    &.op-card-info-warning {
      @include op-card-info($color-warning-1);
    }
  }
}

@media screen and (min-width: 1440px) {
  .op-card {
    &-content {
      font-size: 48px;
    }
  }
}

@media screen and (max-width: 1440px) {
  .op-card {
    &-content {
      font-size: 36px;
    }
  }
}
