/* ==========================================================================
   EntegreSmart ERP — design tokens
   Palette colors are NOT repeated here: they come from Theme/ErpTheme.cs through the
   --mud-palette-* variables that MudThemeProvider writes for the active (light/dark) theme.
   This file only adds what the MudBlazor palette has no slot for (soft fills, the brand
   accent, spacing, radius, elevation, typography). It is the only CSS file allowed to
   contain literal colors.
   ========================================================================== */

:root {
    /* Palette (single source: ErpTheme.cs) */
    --erp-primary: var(--mud-palette-primary);
    --erp-primary-hover: var(--mud-palette-primary-darken);
    --erp-on-primary: var(--mud-palette-primary-text);
    --erp-secondary: var(--mud-palette-secondary);
    --erp-on-secondary: var(--mud-palette-secondary-text);
    --erp-bg: var(--mud-palette-background);
    --erp-surface: var(--mud-palette-surface);
    --erp-surface-sunken: var(--mud-palette-background-gray);
    --erp-surface-hover: var(--mud-palette-table-hover);
    --erp-text: var(--mud-palette-text-primary);
    --erp-text-secondary: var(--mud-palette-text-secondary);
    --erp-border: var(--mud-palette-lines-default);
    --erp-border-strong: var(--mud-palette-lines-inputs);
    --erp-divider: var(--mud-palette-divider-light);
    --erp-success: var(--mud-palette-success);
    --erp-warning: var(--mud-palette-warning);
    --erp-danger: var(--mud-palette-error);
    --erp-info: var(--mud-palette-info);
    --erp-switch-track-on: #2E7D32;
    --erp-switch-thumb-on: #FFFFFF;
    --erp-switch-track-off: #9C94A0;
    --erp-switch-thumb-off: #FFFFFF;
    --erp-switch-track-disabled: #D9D4DB;
    --erp-switch-thumb-disabled: #A9A1AB;

    /* Not in the MudBlazor palette — light theme */
    --erp-accent: #FD8087;              /* logo coral: decorative brand signature only */
    --erp-text-muted: #6E6571;          /* ≥ 4.5:1 on background and surface */
    --erp-text-inverse: #FFFFFF;
    --erp-primary-soft: #E6F4FA;
    --erp-primary-soft-text: #08587A;
    --erp-secondary-soft: #F1EEF1;
    --erp-success-soft: #EAF7F0;
    --erp-warning-soft: #FFF4D6;
    --erp-danger-soft: #FDECEA;
    --erp-info-soft: #E8F1FA;
    --erp-neutral: #5E5662;
    --erp-neutral-soft: #EFEDF0;
    --erp-logo-tile: transparent;       /* the logo needs no backing on light surfaces */
    --erp-overlay: rgba(31, 26, 33, 0.48);

    /* Typography */
    --erp-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --erp-font-mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SFMono-Regular", monospace;
    --erp-text-xs: 0.75rem;
    --erp-text-sm: 0.8125rem;
    --erp-text-md: 0.875rem;
    --erp-text-lg: 1rem;
    --erp-text-xl: 1.25rem;
    --erp-text-2xl: 1.5rem;

    /* Spacing (4px base) */
    --erp-space-1: 4px;
    --erp-space-2: 8px;
    --erp-space-3: 12px;
    --erp-space-4: 16px;
    --erp-space-5: 20px;
    --erp-space-6: 24px;
    --erp-space-8: 32px;
    --erp-space-10: 40px;
    --erp-space-12: 48px;

    /* Radius & elevation: flat cards with a 1px border; shadows only for floating layers */
    --erp-radius-sm: 6px;
    --erp-radius-md: 8px;
    --erp-radius-lg: 10px;
    --erp-radius-pill: 999px;
    --erp-shadow-sm: 0 1px 3px rgba(31, 26, 33, 0.06), 0 1px 2px rgba(31, 26, 33, 0.04);
    --erp-shadow-lg: 0 16px 32px -8px rgba(31, 26, 33, 0.18);

    /* Focus & motion (color/opacity only, short) */
    --erp-focus-outline: 2px solid var(--erp-primary);
    --erp-transition: 140ms cubic-bezier(0.2, 0, 0, 1);

    /* Layout (mirrors ErpTheme.SidebarWidth / SidebarCollapsedWidth / TopBarHeight) */
    --erp-sidebar-width: 248px;
    --erp-sidebar-collapsed-width: 64px;
    --erp-topbar-height: 56px;
    --erp-content-max: 1440px;

    color-scheme: light;
}

[data-theme="dark"] {
    --erp-accent: #FF8A92;
    --erp-text-muted: #958C97;
    --erp-text-inverse: #1B181D;
    --erp-primary-soft: rgba(92, 198, 238, 0.14);
    --erp-primary-soft-text: #8FD8F4;
    --erp-secondary-soft: rgba(185, 169, 183, 0.14);
    --erp-success-soft: rgba(95, 211, 154, 0.14);
    --erp-warning-soft: rgba(245, 196, 81, 0.14);
    --erp-danger-soft: rgba(249, 112, 102, 0.14);
    --erp-info-soft: rgba(124, 184, 240, 0.14);
    --erp-neutral: #B3AAB4;
    --erp-neutral-soft: #241F26;
    --erp-logo-tile: #F6F5F7;           /* keeps the logo's black outlines readable on dark surfaces */
    --erp-overlay: rgba(0, 0, 0, 0.6);
    --erp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --erp-shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, 0.6);
    --erp-switch-track-on: #3FA66D;
    --erp-switch-thumb-on: #F4FFF8;
    --erp-switch-track-off: #625A65;
    --erp-switch-thumb-off: #F0ECF1;
    --erp-switch-track-disabled: #332D35;
    --erp-switch-thumb-disabled: #6E6571;

    color-scheme: dark;
}

/* Global boolean control standard: active=green, passive=gray, disabled=muted. */
.mud-switch .mud-switch-base {
    color: var(--erp-switch-thumb-off) !important;
}

.mud-switch .mud-switch-base + .mud-switch-track {
    background-color: var(--erp-switch-track-off) !important;
    opacity: 1 !important;
}

.mud-switch .mud-switch-base.mud-checked {
    color: var(--erp-switch-thumb-on) !important;
}

.mud-switch .mud-switch-base.mud-checked + .mud-switch-track {
    background-color: var(--erp-switch-track-on) !important;
    opacity: 1 !important;
}

.mud-switch.mud-disabled,
.mud-switch:has(.mud-switch-disabled) {
    cursor: default;
    opacity: .58;
    pointer-events: none;
}

.mud-switch .mud-switch-base.mud-switch-disabled {
    color: var(--erp-switch-thumb-disabled) !important;
}

.mud-switch .mud-switch-base.mud-switch-disabled + .mud-switch-track {
    background-color: var(--erp-switch-track-disabled) !important;
    opacity: 1 !important;
}
