import { createTheme, mergeThemeOverrides } from '@mantine/core';
import { baseTheme } from './base-theme';
import { emaBlue, emaSecondary } from './palettes';

/**
 * Backoffice theme.
 *
 * Structure, scale and component defaults come from `baseTheme`; this file
 * contributes only the brand. The backoffice keeps its own blue rather than
 * adopting the portal's: shade 8 (#1e40af) is the higher-contrast choice for a
 * tool staff read all day, and a distinct accent tells an officer at a glance
 * which of the two systems they are looking at — worth having when both share
 * a domain vocabulary but not the same authority.
 *
 * The export name is load-bearing: `libs/shared/src/index.ts` and the
 * backoffice's MantineThemeProvider both import `emaTheme` by name.
 *
 * Note this theme does NOT override `colors.gray`. The portal's blue-tinted
 * neutrals shift every dimmed label, neutral badge and table border, so that
 * change is being made one app at a time rather than as a side effect of
 * sharing a base.
 */
export const emaTheme = mergeThemeOverrides(
  baseTheme,
  createTheme({
    primaryColor: 'emaPrimary',
    colors: {
      emaPrimary: emaBlue,
      emaSecondary,
    },
  }),
);
