@use '../style/theming';

// MARK: Variables

// MARK: Mixin
@mixin core() {
  // Generic forge disabled class for fields that only need CSS-based disabling.
  // NOTE: the `opacity: 0.38` literal used here and in `.dbx-forge-form-disabled` below
  // is the Material 3 disabled-state content opacity. M3 exposes no `--mat-sys-*`
  // disabled-opacity token, so the literal is intentional (see VISUAL_CHANGES.md KEEP-2).
  .dbx-forge-disabled {
    opacity: 0.38;
    pointer-events: none;
    --mat-list-list-item-disabled-label-text-opacity: unset;
  }

  // Form-level disabled state: disables all interactive elements inside a forge form.
  // Applied to <dbx-forge> host when the form is disabled. This handles built-in ng-forge
  // material fields (input, textarea, select, datepicker, toggle, checkbox) that don't
  // have custom disabled propagation. Custom forge field components additionally use
  // inject(FORM_OPTIONS) for programmatic disabled handling (e.g. disabling FormControls).
  .dbx-forge-form-disabled {
    // Disable pointer events on all standard interactive elements
    input,
    textarea,
    select,
    button,
    mat-select,
    mat-slider,
    mat-checkbox,
    mat-slide-toggle,
    mat-chip-listbox,
    mat-chip-grid,
    .mat-mdc-form-field {
      pointer-events: none;
    }

    // Reduce opacity on form fields to indicate disabled state
    .mat-mdc-form-field {
      opacity: 0.38;
    }

    // Reduce opacity on hint/description/error elements that render outside mat-form-field.
    // These custom forge field components render subscript text (hints, errors, descriptions)
    // as siblings beside their mat-form-field containers, so the rule above does not reach them.
    .dbx-forge-datetime-hint,
    .dbx-forge-datetime-error,
    .dbx-forge-datetime-desc,
    .dbx-forge-daterange-field > mat-hint,
    .dbx-forge-daterange-field > mat-error,
    .dbx-form-repeat-array-bar,
    .dbx-form-repeat-array-footer {
      opacity: 0.38;
    }

    // The expand trigger has no mat-form-field wrapping and needs both visual
    // and interaction disabling.
    dbx-forge-expand-field {
      opacity: 0.38;
      pointer-events: none;
    }
  }
}

@mixin theme($theme-config) {
}
