@use "@angular/material" as mat;
@use "variables/ndb-light-theme" as theme;
@use "sass:map";

$err-palette: mat.m2-define-palette(mat.$m2-red-palette);
$warn-palette: mat.m2-define-palette(mat.$m2-orange-palette);
$success-palette: mat.m2-define-palette(mat.$m2-green-palette);

$success: mat.m2-get-color-from-palette($success-palette);
$warn: mat.m2-get-color-from-palette($warn-palette);
$error: mat.m2-get-color-from-palette($err-palette);

$primary: mat.m2-get-color-from-palette(theme.$primary);
$accent: mat.m2-get-color-from-palette(theme.$accent);

$grey-transparent: mat.m2-get-color-from-palette(
  mat.$m2-grey-palette,
  $hue: 400,
  $opacity: 0.1
);
$grey-light: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 50);
$grey-medium: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 100);
$grey-darker: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 300);

$muted: rgba(0, 0, 0, 0.54);
$muted-background: mat.m2-get-color-from-palette(mat.$m2-grey-palette);
$disabled: rgba(0, 0, 0, 0.38);
$disabled-transparent: $grey-transparent;
$border-color: $grey-darker;

/* color for inactive or archived elements */
$inactive: grey;

/* background for the main view */
$background: white;
/* background for the sidebar */
$background-secondary: mat.m2-get-color-from-palette(theme.$primary, 50);
/* light grey color background to highlight special ui elements */
$background-neutral: mat.m2-get-color-from-palette(
  mat.$m2-light-theme-background-palette,
  card
);

/* especially for labels in disabled forms (which is our default view) */
$text: mat.m2-get-color-from-palette(
  mat.$m2-light-theme-foreground-palette,
  text
);
$text-secondary: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 800);
$hint-text: mat.m2-get-color-from-palette(
  mat.$m2-light-theme-foreground-palette,
  hint-text
);

/*
 * Quantized warning-levels. Each level represents a color from green (all is OK)
 * to red (nothing is OK).
 *
 * classes will be generated with the prefix 'w-', i.e.
 * 'w-100', 'w-90', ..., 'w-0'
 */
$w-levels: (
  100: #90ee90,
  90: #a5e46e,
  80: #bcd84e,
  70: #d2c92e,
  60: #e9b90f,
  50: #ffa500,
  40: #ff982a,
  30: #ff8b40,
  20: #ff8153,
  10: #ff7863,
  0: #fd7272,
);

@function w-level($level) {
  @return map.get($w-levels, $level);
}

/* Levels that are used when describing attendance values */
$attendance-levels: (
  /* Present */ P: #c8e6c9,
  /* Holiday */ H: #cfd8dc,
  /* Late */ L: #ffecb3,
  /* Excused */ E: #d7ccc8,
  /* Absent */ A: #ff8a65,
  /* Unknown */ U: #dddddd
);
