@use '@angular/material' as mat;

// ---- Themes ----
$light-theme: mat.define-theme((
  color: ( theme-type: light, primary: mat.$cyan-palette, tertiary: mat.$orange-palette ),
  typography: ( brand-family: 'Inter, Roboto, Arial, sans-serif', bold-weight: 600 ),
  density: ( scale: 0 ),
));

$dark-theme: mat.define-theme((
  color: ( theme-type: dark,  primary: mat.$cyan-palette, tertiary: mat.$orange-palette ),
));

// ---- Core + Components ----
@include mat.core-theme($light-theme);
@include mat.all-component-themes($light-theme);


// Dark-Mode
.dark {
  @include mat.all-component-colors($dark-theme);
}

/* ---- Custom variables ---- */
:root {
  --app-topbar-bg: #{mat.get-theme-color($light-theme, surface)};
  --app-bg: #{mat.get-theme-color($light-theme, surface-container-low)};
  --app-fg: #{mat.get-theme-color($light-theme, on-surface)};
  --app-logo-bg: #313131;
  --app-card-background: #fafafa;

  --card-radius: 18px;
  --card-bg: var(--app-card-background);
  --card-border-inset: rgba(255, 255, 255, 0.35);
  --card-border-inset-dark: rgba(0, 0, 0, 0.35);

  --link-color: #38a7ff;
  --link-color-hover: #66bfff;
}
.dark {
  --app-topbar-bg: #{mat.get-theme-color($dark-theme, surface-container-highest)};
  --app-bg:  #{mat.get-theme-color($dark-theme,surface-variant)};
  --app-fg: #{mat.get-theme-color($dark-theme, on-surface)};
  --app-card-background: #313131;
  --app-logo-bg: #313131;

  --card-bg: var(--app-card-background);

  --link-color: #6dbcff;
  --link-color-hover: #9ad2ff;
}

/* ---- global background and tests ---- */
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, Roboto, Arial, sans-serif;
  background-color: var(--app-bg);
  color: var(--app-fg);
  transition: background-color 220ms ease, color 220ms ease;
}

.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,   /* 0 oder 1 */
    "wght" 400, /* 100..700 */
    "GRAD" 0,   /* -50..200 */
    "opsz" 24;  /* 20..48 */
}

/* smooth transition between theme change */
.mat-toolbar,
.mat-mdc-card,
.mat-sidenav,
.mat-mdc-menu-panel,
.mat-mdc-dialog-container,
.mat-mdc-select-panel,
.mat-mdc-snack-bar-container,
.cdk-overlay-pane {
  transition:
    background-color 220ms ease,
    color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    fill 220ms ease;
}

/* links */
a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;

  &:hover {
    color: var(--link-color-hover);
    text-decoration: underline;
  }
}

/* cards */
.mat-mdc-card {
  position: relative;
  border-radius: var(--card-radius) !important;
  background: var(--card-bg) !important;
  box-shadow: var(--card-shadow-outer);
  overflow: hidden;

  border: none;

  transition:
    box-shadow 200ms ease,
    transform 200ms ease;
}

.mat-mdc-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;

  box-shadow:
    inset 0 1px 0 var(--card-border-inset),
    inset 0 -1px 0 var(--card-border-inset-dark);
}

.mat-mdc-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
}

/* accordion */
/* expansion panels like cards */
.mat-accordion {
  display: grid;
  gap: 8px;
}

.mat-accordion .mat-expansion-panel {
  border-radius: var(--card-radius) !important;
  background: var(--card-bg) !important;
  overflow: hidden; /* ok */
  border: none !important;
}


.mat-accordion .mat-expansion-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;

  box-shadow:
    inset 0 1px 0 var(--card-border-inset),
    inset 0 -1px 0 var(--card-border-inset-dark);
}

.mat-accordion .mat-expansion-panel::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
}

.mat-expansion-panel-header {
  background: transparent !important;
}

.mat-expansion-panel-body {
  padding-top: 0;
}

.image-dialog-panel .mat-mdc-dialog-surface {
  border-radius: 16px;
  overflow: hidden;
}

.image-dialog-panel .mat-mdc-dialog-content {
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  max-height: none !important;
}

.image-dialog-panel .mat-mdc-dialog-container {
  padding: 0;
}

.link-row {
  grid-row: 2;
  grid-column: 2;
  margin-top: .1rem;
  opacity: .85;
  vertical-align: center;
}

.link-with-icon {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  line-height: 1;
}

.link-with-icon mat-icon {
  font-size: 18px;
  height: 18px;
  width: 18px;
}
