@use 'ej2-base/styles/common/mixin' as *;
@mixin ripple-container {
  bottom: $cbox-ripple-small-size;
  height: $cbox-ripple-small-height;
  left: $cbox-ripple-small-size;
  right: $cbox-ripple-small-size;
  top: $cbox-ripple-small-size;
  width: $cbox-ripple-small-width;
}

@include export-module('checkbox-layout') {
  .e-checkbox-wrapper,
  .e-css.e-checkbox-wrapper {
    cursor: pointer;
    display: inline-block;
    line-height: $cbox-wrapper-line-height;
    outline: none;
    user-select: none;
    @if $skin-name == 'FluentUI' {
      border: 1px solid transparent;
      padding: 3px;
    }
    @if $skin-name == 'fluent2' {
      border-radius: $cbox-nrml-checkbox-border-radius;
      border: 1px solid transparent;
      line-height: $cbox-label-line-height;
    }
    @at-root {
      & label {
        cursor: pointer;
        display: inline-block;
        line-height: $cbox-label-line-height;
        margin: $cbox-zero-margin;
        position: relative;
        white-space: nowrap;
      }

      &:focus,
      &.e-focus {
        & .e-frame {
          & {
            box-shadow: $cbox-focussed-box-shadow;
          }
          @if $skin-name == 'bootstrap5.3' {
            & {
              border-color: $border-focus;
            }
          }
        }
        @if $skin-name == 'FluentUI' {
          & {
            border: 1px solid $cbox-border-color;
            padding: 3px;
          }
        }
        @if $skin-name == 'fluent2' {
          & {
            border-radius: $cbox-nrml-checkbox-border-radius;
            box-shadow: $shadow-focus-ring1;
          }
        }
      }

      &:active {
        & .e-frame {
          @if $skin-name == 'bootstrap5.3' {
            box-shadow: $cbox-focussed-box-shadow;
            border-color: $border-focus !important; /* stylelint-disable-line declaration-no-important */
            background-color: $content-bg-color-pressed;
          }
          @if $skin-name == 'tailwind3' {
            box-shadow: $cbox-focussed-box-shadow;
          }
        }
      }

      & .e-ripple-container {
        border-radius: $cbox-ripple-container-border-radius;
        bottom: $cbox-ripple-size;
        height: $cbox-ripple-height;
        left: $cbox-ripple-size;
        pointer-events: none;
        position: absolute;
        right: $cbox-ripple-size;
        top: $cbox-ripple-size;
        width: $cbox-ripple-width;
        z-index: 1;

        & .e-ripple-element {
          @if $skin-name == 'Material3' {
            border-radius: $cbox-ripple-container-border-radius;
          }
        }
      }

      & .e-label {
        cursor: pointer;
        display: inline-block;
        font-family: $font-family;
        font-size: $cbox-font-size;
        font-weight: normal;
        line-height: $cbox-height;
        user-select: none;
        vertical-align: middle;
        white-space: normal;
        @if $skin-name == 'tailwind3' {
          font-weight: $font-weight-medium;
        }
      }

      & .e-checkbox {
        height: $cbox-nrml-height;
        opacity: 0;
        position: absolute;
        width: $cbox-nrml-width;

        +.e-label {
          @if $skin-name == 'fluent2' {
            margin: $cbox-nrml-label-margin;
          }
          @else {
            margin-right: $cbox-margin;
          }
        }
      }

      & .e-frame {
        border: $cbox-border;
        border-radius: $cbox-border-radius;
        box-sizing: border-box;
        cursor: pointer;
        display: inline-block;
        font-family: 'e-icons';
        height: $cbox-height;
        line-height: $cbox-lineheight;
        padding: $cbox-padding;
        text-align: center;
        vertical-align: middle;
        width: $cbox-width;
        @if $skin-name == 'fluent2' {
          margin: $cbox-nrml-frame-margin;
        }

        +.e-label {
          @if $skin-name == 'fluent2' {
            margin: $cbox-nrml-label-frame-margin;
          }
          @else {
            margin-left: $cbox-margin;
          }
        }

        +.e-ripple-container {
          left: $cbox-auto-width;
        }
      }

      & .e-check {
        font-size: $cbox-check-fontsize;
      }

      & .e-stop {
        font-size: $cbox-indeterminate-fontsize;
        line-height: $cbox-indeterminate-lineheight;
      }

      &.e-checkbox-disabled {
        cursor: default;
        pointer-events: none;
        @if $skin-name == 'bootstrap5.3' {
          opacity: .5;
        }

        & .e-frame {
          cursor: default;
        }

        & .e-label {
          cursor: default;
        }
      }

      &.e-rtl {
        .e-ripple-container {
          right: $cbox-ripple-size;
        }

        & .e-frame {
          @if $skin-name != 'fluent2' {
            margin: $cbox-zero-margin;
          }

          &:hover {
            background-color: $cbox-hover-bgcolor;
            border-color: $cbox-hover-border-color;
            @if $skin-name == 'FluentUI' {
              &:not(.e-check),
              &:not(.e-stop)::before {
                content: $cbox-check-content;
                font-size: $cbox-check-fontsize;
              }
            }
          }

          + .e-ripple-container {
            left: $cbox-ripple-size;
            right: $cbox-auto-width;
          }
        }

        & .e-label {
          @if $skin-name == 'fluent2' {
            margin: $cbox-nrml-label-margin;
          }
          @else {
            margin-left: $cbox-zero-margin;
            margin-right: $cbox-margin;
          }

          +.e-frame {
            @if $skin-name != 'fluent2' {
              margin: $cbox-zero-margin;
            }
          }
        }

        & .e-checkbox {
          +.e-label {
            @if $skin-name == 'fluent2' {
              margin: $cbox-nrml-label-margin;
            }
            @else {
              margin-left: $cbox-margin;
              margin-right: $cbox-zero-margin;
            }
          }
        }
      }

      &.e-small {
        & .e-frame {
          height: $cbox-small-height;
          line-height: $cbox-small-lineheight;
          width: $cbox-small-width;
        }

        & .e-check {
          font-size: $cbox-small-check-fontsize;
        }

        & .e-stop {
          font-size: $cbox-small-indeterminate-fontsize;
          line-height: $cbox-small-indeterminate-lineheight;
        }

        & .e-label {
          font-size: $cbox-small-font-size;
          line-height: $cbox-small-height;
        }

        & .e-ripple-container {
          @include ripple-container;
        }
      }
    }
  }

  .e-overlay .e-checkbox-wrapper.e-pointer-event .e-ripple-container {
    pointer-events: none;
  }

  .e-checkbox-wrapper.e-pointer-event .e-ripple-container{
    pointer-events: auto;
  }

  .e-checkbox-wrapper[readonly] {
    pointer-events: none;
  }

  .e-small .e-checkbox-wrapper,
  .e-small.e-checkbox-wrapper,
  .e-small .e-css.e-checkbox-wrapper,
  .e-small.e-css.e-checkbox-wrapper {
    & .e-frame {
      height: $cbox-small-height;
      line-height: $cbox-small-lineheight;
      width: $cbox-small-width;
      @if $skin-name == 'fluent2' {
        margin: $cbox-small-frame-margin;
      }

      &:hover {
        background-color: $cbox-hover-bgcolor;
        border-color: $cbox-hover-border-color;
        @if $skin-name == 'FluentUI' {
          &:not(.e-check),
          &:not(.e-stop)::before {
            content: $cbox-check-content;
            font-size: $cbox-small-check-fontsize;
          }
        }
      }
    }

    & .e-check {
      font-size: $cbox-small-check-fontsize;
    }

    & .e-stop {
      font-size: $cbox-small-indeterminate-fontsize;
      line-height: $cbox-small-indeterminate-lineheight;
    }

    & .e-label {
      font-size: $cbox-small-font-size;
      line-height: $cbox-small-height;
    }

    & .e-ripple-container {
      @include ripple-container;
    }
  }
}
