@use '../../../scss/variables' as *;

.checkbox-control {
  -webkit-touch-callout: none;
  width: 16px;
  height: 16px;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;

  &:focus-within {
    outline: $focus-outline;
  }

  input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* hide the checkbox */
    margin: 0;
    padding: 0;
    opacity: 0;
    border: none;
    outline: none;
    background: none;
    appearance: none;
  }

  .checkbox-control-base,
  .checkbox-control-checked {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }

  .checkbox-control-base {
    pointer-events: none;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--secondary-color);
  }

  .checkbox-control-checked {
    background: var(--active-controls-color);
    transition: all 0.15s ease;
    opacity: 0;
  }

  input:checked + .checkbox-control-base {
    border: none;

    .checkbox-control-checked {
      opacity: 1;
    }
  }

  &.checkbox-standard {
    width: 18px;
    height: 18px;

    svg {
      vertical-align: top;
      fill: var(--foreground-color);
    }
  }
}
