/**
 * Unified theme file using CSS selectors instead of !important overrides
 * Theme switching is controlled via data-theme attribute on html element
 */

/* Default (Dark) Theme */
html,
html[data-theme="dark"] {
  --fontFamily: Arial;
  --matchCaseButtonFontFamily: Georgia, serif;
  --textColor: var(--accent-50);
  --menuTextColor: var(--accent-50);
  --textColorInverted: var(--accent-50);
  --textShadowColor: var(--accent-50);
  --baseColor: var(--surface-100);
  --baseColorDarken: var(--surface-50);
  --baseColorDark: var(--surface-0);
  --baseColorBackground: var(--surface-100);
  --borderColor: var(--base-500);
  --activeColor: var(--surface-50);
  --inactiveColor: var(--surface-0);
  --secondaryBaseColor: var(--accent-900);
  --secondaryAccentColor: var(--accent-400);
  --secondaryAccentColorDarken: var(--accent-600);
  --defaultTextHeaderColor: var(--accent-950);
  --inputLineColor: var(--accent-200);
  --inputBorderColor: var(--accent-600);
  --tableBackgroundColor: var(--surface-50);
  --tableAccentColor: var(--accent-600);
  --menuBackgroundColor: var(--base-800);
  --menuBackgroundHoverColor: var(--base-500);
  --dialogButtonBackgroundColor: var(--accent-100);
  --goodSeverityColor: #80ff80;
  --warningSeverityColor: #ffff80;
  --errorSeverityColor: #ff6c6c;
  --sidebarBackgroundColor: #7a7a7a;
  --sidebarTextColor: var(--accent-50);
  --sidebarHoverColor: #871719;
  --drawerBackgroundColor: #871719;
  --controlDisabledColor: #4e4e4e;
  --controlHoverBackgroundColor: #0d0d0d;
  --errorMessageColor: #a94442;
  --rubberBandColor: #ff0000;
  
  /* Tailwind style colors - Dark theme palette */
  --base-50: #f4f7f7;
  --base-100: #e3e9ea;
  --base-200: #cad6d7;
  --base-300: #a6b9ba;
  --base-400: #799597;
  --base-500: #5e797c;
  --base-600: #516569;
  --base-700: #465558;
  --base-800: #3e4a4c;
  --base-900: #2d3436;
  --base-950: #22282a;
  --accent-50: #f6f6f6;
  --accent-100: #e7e7e7;
  --accent-200: #d1d1d1;
  --accent-300: #b0b0b0;
  --accent-400: #7c7c7c;
  --accent-500: #6d6d6d;
  --accent-600: #5d5d5d;
  --accent-700: #4f4f4f;
  --accent-800: #454545;
  --accent-900: #3d3d3d;
  --accent-950: #262626;

  /* Surface colors for backgrounds and container surfaces - Dark theme */
  --surface-0: #22282a;
  --surface-50: #2d3436;
  --surface-100: #3e4a4c;
  --surface-200: #465558;
  --surface-300: #516569;
}

/* Light Theme */
html[data-theme="light"] {
  --fontFamily: Arial;
  --matchCaseButtonFontFamily: Georgia, serif;
  --textColor: var(--base-950);
  --menuTextColor: var(--accent-950);
  --textColorInverted: var(--accent-500);
  --textShadowColor: var(--accent-900);
  --baseColor: var(--surface-0);
  --baseColorDarken: var(--surface-50);
  --baseColorDark: var(--surface-100);
  --baseColorBackground: var(--surface-50);
  --borderColor: var(--base-300);
  --activeColor: var(--surface-100);
  --inactiveColor: var(--surface-50);
  --secondaryBaseColor: var(--accent-100);
  --secondaryAccentColor: var(--accent-500);
  --secondaryAccentColorDarken: var(--accent-600);
  --defaultTextHeaderColor: var(--accent-950);
  --inputLineColor: var(--base-200);
  --inputBorderColor: var(--base-300);
  --tableBackgroundColor: var(--surface-0);
  --tableAccentColor: var(--accent-500);
  --menuBackgroundColor: var(--surface-50);
  --menuBackgroundHoverColor: var(--surface-200);
  --dialogButtonBackgroundColor: var(--surface-100);
  --goodSeverityColor: #80ff80;
  --warningSeverityColor: #ffff80;
  --errorSeverityColor: #ff6c6c;
  --sidebarBackgroundColor: var(--surface-50);
  --sidebarTextColor: var(--textColor);
  --sidebarHoverColor: var(--accent-700);
  --drawerBackgroundColor: var(--accent-700);
  --controlDisabledColor: #aaaaaa;
  --controlHoverBackgroundColor: #b5b5b5;
  --errorMessageColor: #a94442;
  --rubberBandColor: #ff0000;
  
  /* Tailwind style colors - Light/Gray theme with muted tones */
  --base-50: #efefef;
  --base-100: #e2e2e2;
  --base-200: #cdcdcd;
  --base-300: #b5b5b5;
  --base-400: #9c9c9c;
  --base-500: #848484;
  --base-600: #616161;
  --base-700: #4a4a4a;
  --base-800: #363636;
  --base-900: #2a2a2a;
  --base-950: #1f1f1f;
  --accent-50: #e4edf5;
  --accent-100: #d0e0ee;
  --accent-200: #a8c5de;
  --accent-300: #82abce;
  --accent-400: #5e92be;
  --accent-500: #4478a5;
  --accent-600: #376289;
  --accent-700: #2b4d6d;
  --accent-800: #203a52;
  --accent-900: #162838;
  --accent-950: #0c1929;

  /* Surface colors for backgrounds and container surfaces - Gray theme */
  --surface-0: #dedede;
  --surface-50: #d0d0d0;
  --surface-100: #bcbcbc;
  --surface-200: #aaaaaa;
  --surface-300: #969696;
}

/* Material Tab Header Overrides - Dark Theme */
html[data-theme="dark"] .mat-mdc-tab-group,
html:not([data-theme]) .mat-mdc-tab-group {
  --mat-tab-header-active-label-text-color: var(--accent-50);
  --mat-tab-header-inactive-label-text-color: var(--accent-300);
  --mat-tab-header-active-focus-label-text-color: var(--accent-50);
  --mat-tab-header-active-hover-label-text-color: var(--accent-50);
  --mat-tab-header-inactive-hover-label-text-color: var(--accent-200);
  --mat-tab-header-inactive-focus-label-text-color: var(--accent-200);
  --mat-tab-header-active-focus-indicator-color: var(--accent-50);
  --mat-tab-header-active-hover-indicator-color: var(--accent-50);
}

/* Material Tab Header Overrides - Light Theme */
html[data-theme="light"] .mat-mdc-tab-group {
  --mat-tab-header-active-label-text-color: var(--base-950);
  --mat-tab-header-inactive-label-text-color: var(--base-600);
  --mat-tab-header-active-focus-label-text-color: var(--base-950);
  --mat-tab-header-active-hover-label-text-color: var(--base-950);
  --mat-tab-header-inactive-hover-label-text-color: var(--base-800);
  --mat-tab-header-inactive-focus-label-text-color: var(--base-800);
  --mat-tab-header-active-focus-indicator-color: var(--base-950);
  --mat-tab-header-active-hover-indicator-color: var(--base-950);
}

/* AG Grid Theme Overrides - Dark Theme */
html[data-theme="dark"] .ag-theme-balham,
html:not([data-theme]) .ag-theme-balham {
  --ag-foreground-color: #e7e7e7;
  --ag-background-color: var(--surface-0);
  --ag-header-background-color: #1c1c1c;
  --ag-subheader-background-color: var(--surface-100);
  --ag-border-color: #5e797c;
  --ag-odd-row-background-color: var(--surface-50);
  --ag-row-hover-color: var(--surface-100);
  --ag-column-hover-color: var(--surface-200);
  --ag-secondary-foreground-color: var(--ag-foreground-color);
  --ag-header-foreground-color: rgba(231, 231, 231, 0.64);
  --ag-header-column-separator-color: rgba(94, 121, 124, 0.5);
}

/* AG Grid Theme Overrides - Light Theme */
html[data-theme="light"] .ag-theme-balham {
  --ag-foreground-color: #1f1f1f;
  --ag-background-color: var(--surface-0);
  --ag-header-background-color: var(--surface-50);
  --ag-subheader-background-color: var(--surface-100);
  --ag-border-color: #969696;
  --ag-odd-row-background-color: var(--surface-50);
  --ag-row-hover-color: var(--surface-100);
  --ag-column-hover-color: var(--surface-200);
  --ag-secondary-foreground-color: rgba(31, 31, 31, 0.54);
  --ag-header-foreground-color: rgba(31, 31, 31, 0.64);
}
