@use 'libs/components/theme/src/lib/styles/mixins' as mixins;
@use 'libs/components/theme/src/lib/styles/variables' as *;
@use 'libs/components/theme/src/lib/styles/compat-tokens-mixins' as compatMixins;

@include compatMixins.sky-modern-overrides('.sky-checkbox-outer-wrapper') {
  --sky-override-checkbox-checked-color: var(--sky-color-icon-action);
  --sky-override-checkbox-checked-color-disabled: #{$sky-text-color-default};
  --sky-override-checkbox-indeterminate-font-size: 14px;
  --sky-override-checkbox-label-margin-right: var(--sky-margin-inline-xs);
}

@include mixins.sky-component-host('modern') {
  display: inline-block;

  .sky-switch:not(:has(~ .sky-control-help-container)):not(
      :has(.sky-switch-control-icon)
    ):has(sky-checkbox-label-text-label) {
    margin-right: var(--sky-override-checkbox-label-margin-right, 0);
  }
}

@include mixins.sky-component('modern', '.sky-checkbox-outer-wrapper') {
  display: flex;

  .sky-checkbox-help-inline {
    display: inline-flex;
  }

  .sky-checkbox-label {
    padding-left: var(--sky-space-gap-label-s);
  }

  .sky-checkbox-icon-indeterminate {
    font-size: var(
      --sky-override-checkbox-indeterminate-font-size,
      var(--sky-size-icon-s)
    );
  }

  .sky-checkbox-icon-modern-checked {
    font-size: var(--sky-size-icon-s);
  }

  .sky-switch-control {
    border-radius: var(--sky-border-radius-s);
  }
}

@include mixins.sky-component('modern', '.sky-checkbox-hint-text') {
  margin-top: var(--sky-space-gap-stacked_supplemental-s);
}

@include mixins.sky-component('modern', '.sky-checkbox-form-margin') {
  display: block;
  margin-left: var(--sky-space-inset-switch);
}

@include mixins.sky-component-host('modern', ':host.sky-form-field-stacked') {
  display: block;
}

@include mixins.sky-component-host(
  'modern',
  ':host-context(sky-checkbox-group .sky-checkbox-group-stacked) :host'
) {
  display: block;

  &:not(:last-child) {
    margin-bottom: var(--sky-space-gap-form-s);
  }
}
