/*
 * Copyright (c) 2026, Salesforce, Inc.,
 * All rights reserved.
 * For full license text, see the LICENSE.txt file
 */

@layer theme {
  .slds-checkbox {
    /* Sizing */
    --slds-c-checkbox-size: var(--slds-g-sizing-5);
    --slds-c-checkbox-sizing-border: var(--slds-s-mark-sizing-border);
    --slds-c-checkbox-radius-border: var(--slds-g-radius-border-1);

    /* Surface — idle */
    --slds-c-checkbox-color-background: var(--slds-s-mark-color-background);
    --slds-c-checkbox-color-border: var(--slds-s-mark-color-border);

    /* Per-state shadow */
    --slds-c-checkbox-shadow-checked: var(--slds-s-mark-shadow-checked);
    --slds-c-checkbox-shadow-focus: var(--slds-g-shadow-outset-focus-1);

    /* Checkmark / dash glyph color and sizing geometry */
    --slds-c-checkbox-mark-color-foreground: var(--slds-s-mark-color-foreground-checked);
    --slds-c-checkbox-mark-sizing-block: var(--slds-g-sizing-2);
    --slds-c-checkbox-mark-sizing-inline: var(--slds-g-sizing-3);
    --slds-c-checkbox-mark-sizing-border: var(--slds-g-sizing-border-2);

    /* Label */
    --slds-c-checkbox-label-font-size: var(--slds-s-label-font-size);
    --slds-c-checkbox-label-color-foreground: var(--slds-g-color-on-surface-2);

    /* Form-element wrapper margin */
    --slds-c-checkbox-margin-inline-end: var(--slds-g-sizing-3);
  }

  /* Checked / indeterminate states. */
  .slds-checkbox [type='checkbox']:checked + .slds-checkbox_faux,
  .slds-checkbox [type='checkbox']:checked ~ .slds-checkbox_faux,
  .slds-checkbox [type='checkbox']:checked + .slds-checkbox__label .slds-checkbox_faux,
  .slds-checkbox [type='checkbox']:indeterminate + .slds-checkbox_faux,
  .slds-checkbox [type='checkbox']:indeterminate ~ .slds-checkbox_faux,
  .slds-checkbox [type='checkbox']:indeterminate + .slds-checkbox__label .slds-checkbox_faux {
    --slds-c-checkbox-color-background: var(--slds-s-mark-color-background-checked);
    --slds-c-checkbox-color-border: var(--slds-s-input-color-border-checked);
  }

  /* Disabled state. */
  .slds-checkbox [type='checkbox'][disabled] + .slds-checkbox_faux,
  .slds-checkbox [type='checkbox'][disabled] ~ .slds-checkbox_faux,
  .slds-checkbox [type='checkbox'][disabled] + .slds-checkbox__label .slds-checkbox_faux,
  .slds-checkbox [type='checkbox'][disabled]:checked + .slds-checkbox_faux,
  .slds-checkbox [type='checkbox'][disabled]:checked ~ .slds-checkbox_faux,
  .slds-checkbox [type='checkbox'][disabled]:checked + .slds-checkbox__label .slds-checkbox_faux {
    --slds-c-checkbox-color-background: var(--slds-g-color-disabled-container-2);
    --slds-c-checkbox-color-border: var(--slds-g-color-border-disabled-1);
    --slds-c-checkbox-mark-color-foreground: var(--slds-g-color-on-disabled-2);
  }

  /* Error context. */
  .slds-has-error .slds-checkbox {
    --slds-c-checkbox-color-border: var(--slds-g-color-border-error-1);
    --slds-c-checkbox-sizing-border: var(--slds-g-sizing-border-2);
  }

  .slds-has-error .slds-checkbox [type='checkbox']:checked + .slds-checkbox_faux,
  .slds-has-error .slds-checkbox [type='checkbox']:checked ~ .slds-checkbox_faux,
  .slds-has-error .slds-checkbox [type='checkbox']:checked + .slds-checkbox__label .slds-checkbox_faux {
    --slds-c-checkbox-color-background: var(--slds-s-mark-color-background-invalid);
    --slds-c-checkbox-mark-color-foreground: var(--slds-s-mark-color-foreground-invalid);
  }
}
