@import './../common/abstracts/_mixin';
@import './../common/abstracts/variable';

.wot-theme-dark {
  @include b(checkbox) {
    @include e(shape) {
      color: $-checkbox-check-color;
      background: transparent;
      border-color: $-checkbox-border-color;
    }

    @include e(label) {
      color: $-dark-color;
    }

    @include when(disabled) {
      .wd-checkbox__shape {
        background: $-dark-background4;
        border-color: $-dark-color-gray;
      }

      .wd-checkbox__label {
        color: $-dark-color-gray;
      }

      :deep(.wd-checkbox__check) {
        color: $-dark-color-gray;
      }

      @include when(checked) {
        .wd-checkbox__shape {
          color: $-dark-color-gray;
        }

        .wd-checkbox__label {
          color: $-dark-color-gray;
        }
      }

      @include when(button) {
        .wd-checkbox__label {
          color: $-dark-color-gray;
          background: #3a3a3c;
          border-color: #c8c9cc;
        }

        @include when(checked) {
          .wd-checkbox__label {
            color: #c8c9cc;
            background: #3a3a3c;
            border-color: #c8c9cc;
          }
        }
      }
    }

    @include when(button) {
      .wd-checkbox__label {
        background-color: $-dark-background;
      }

      @include when(checked) {
        .wd-checkbox__label {
          background-color: $-dark-background2;
        }
      }
    }
  }
}

@include b(checkbox) {
  display: block;
  margin-bottom: $-checkbox-margin;
  font-size: 0;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.2;

  @include when(last-child) {
    margin-bottom: 0;
  }

  @include e(shape) {
    position: relative;
    box-sizing: border-box;
    display: inline-block;
    width: $-checkbox-size;
    height: $-checkbox-size;
    color: $-checkbox-check-color;
    vertical-align: middle;
    background: $-checkbox-bg;
    border: 2px solid $-checkbox-border-color;
    border-radius: 50%;
    transition: background 0.2s;

    @include when(square) {
      border-radius: $-checkbox-square-radius;
    }
  }

  @include e(input) {
    position: absolute;
    width: 0;
    height: 0;
    margin: 0;
    opacity: 0;
  }

  @include edeep(btn-check) {
    display: inline-block;
    margin-right: 4px;
    font-size: $-checkbox-icon-size;
    vertical-align: middle;
  }

  @include e(txt) {
    display: inline-block;
    line-height: 20px;
    vertical-align: middle;
    @include lineEllipsis;
  }

  @include e(label) {
    position: relative;
    display: inline-block;
    margin-left: $-checkbox-label-margin;
    font-size: $-checkbox-label-fs;
    color: $-checkbox-label-color;
    vertical-align: middle;
  }

  @include edeep(check) {
    font-size: $-checkbox-icon-size;
    color: $-checkbox-check-color;
    opacity: 0;
    transition: opacity 0.2s;
  }

  @include when(checked) {
    .wd-checkbox__shape {
      color: $-checkbox-checked-color;
      background: currentColor;
      border-color: currentColor;
    }

    :deep(.wd-checkbox__check) {
      position: absolute;
      top: 50%;
      left: 50%;
      opacity: 1;
      transform: translate(-50%, -50%);
    }
  }

  @include when(button) {
    display: inline-block;
    margin-right: $-checkbox-margin;
    margin-bottom: 0;
    font-size: $-checkbox-button-font-size;
    vertical-align: top;

    @include when(last-child) {
      margin-right: 0;
    }

    .wd-checkbox__shape {
      width: 0;
      height: 0;
      overflow: hidden;
      border: none;
      opacity: 0;
    }

    .wd-checkbox__label {
      box-sizing: border-box;
      display: inline-flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      min-width: $-checkbox-button-min-width;
      height: $-checkbox-button-height;
      padding: 5px 15px;
      margin-left: 0;
      font-size: $-checkbox-button-font-size;
      background-color: $-checkbox-button-bg;
      border: 1px solid $-checkbox-button-border;
      border-radius: $-checkbox-button-radius;
      transition:
        color 0.2s,
        border 0.2s;
    }

    @include when(checked) {
      .wd-checkbox__label {
        color: $-checkbox-checked-color;
        background-color: $-checkbox-bg;
        border-color: $-checkbox-checked-color;
        border-color: currentColor;
      }
    }
  }

  @include when(inline) {
    display: inline-block;
    margin-right: $-checkbox-margin;
    margin-bottom: 0;

    @include when(last-child) {
      margin-right: 0;
    }
  }

  @include when(disabled) {
    .wd-checkbox__shape {
      background: $-checkbox-disabled-check-bg;
      border-color: $-checkbox-border-color;
    }

    .wd-checkbox__label {
      color: $-checkbox-disabled-label-color;
    }

    @include when(checked) {
      .wd-checkbox__shape {
        color: $-checkbox-disabled-check-color;
      }

      .wd-checkbox__label {
        color: $-checkbox-disabled-label-color;
      }
    }

    @include when(button) {
      .wd-checkbox__label {
        color: $-checkbox-disabled-label-color;
        background: $-checkbox-disabled-color;
        border-color: $-checkbox-button-border;
      }

      @include when(checked) {
        .wd-checkbox__label {
          border-color: $-checkbox-button-disabled-border;
        }
      }
    }
  }

  // 以下内容用于解决父子组件样式隔离的问题 —— START
  @include when(cell-box) {
    padding: 13px 15px;
    margin: 0;

    @include when(large) {
      padding: 14px 15px;
    }
  }

  @include when(button-box) {
    box-sizing: border-box;
    display: inline-flex;
    width: 33.3333%;
    padding: 12px 12px 0 0;

    .wd-checkbox__label {
      width: 100%;
    }

    &:last-child::after {
      display: table;
      clear: both;
      content: '';
    }
  }

  @include when(large) {
    .wd-checkbox__shape {
      width: $-checkbox-large-size;
      height: $-checkbox-large-size;
      font-size: $-checkbox-large-size;
    }

    .wd-checkbox__label {
      font-size: $-checkbox-large-label-fs;
    }
  }
}
