@use './variables' as *;
@use './theme' as theme;
@use '@angular/material/prebuilt-themes/deeppurple-amber.css';

// theming

.dark-theme {
  @include theme.create-dark-theme();
}

.lite-theme {
  @include theme.create-light-theme();
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Roboto, 'Helvetica Neue', sans-serif;
  font-size: 1em;
}

// fonts

.cx-font-larger {
  font-size: larger;
}

// links

a {
  color: var(--mat-app-text-color);
}

a:link,
a:visited {
  text-decoration: none;
}

a:active,
a:hover {
  text-decoration: underline;
}

// header
h1,
h2,
h3,
h4 {
  text-transform: uppercase;
  font-weight: bold !important;
  text-align: center;
}

// component sizes

.cx-width-5 {
  width: 5% !important;
}

.cx-width-10 {
  width: 10% !important;
}

.cx-width-20 {
  width: 20% !important;
}

.cx-max-width-20 {
  max-width: 20% !important;
}

.cx-width-25 {
  width: 25% !important;
}

.cx-max-width-25 {
  max-width: 25% !important;
}

.cx-width-33 {
  width: 33% !important;
}

.cx-width-34 {
  width: 34% !important;
}

.cx-width-50 {
  width: 50% !important;
}

.cx-min-width-50 {
  min-width: 50% !important;
}

.cx-width-66 {
  min-width: 66% !important;
}

.cx-width-75 {
  width: 75% !important;
}

.cx-width-80 {
  width: 80% !important;
}

.cx-width-90 {
  width: 90% !important;
}

.cx-width-100 {
  width: 100% !important;
}

.cx-height-50 {
  height: 50% !important;
}

.cx-height-75 {
  height: 75% !important;
}

.cx-height-90 {
  height: 90% !important;
}

.cx-height-100 {
  height: 100% !important;
}

.cx-top-0 {
  top: 0px;
}

.cx-overflow-y-scroll {
  overflow-y: auto;
}

.cx-overflow-y-clip {
  overflow-y: clip;
}

// positioning

.cx-overlay {
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.286);
  z-index: 100;
  top: 0;
  left: 0;
  position: fixed;
}

.cx-hover {
  background-color: rgba(0, 0, 0, 0.286);
  z-index: 10;
  top: 0;
  left: 0;
  padding: 5px;
  position: fixed;
}

.cx-display-block {
  display: block;
}

// padding

.cx-padding-0 {
  padding: 0px !important;
}

.cx-padding-left-5 {
  padding-left: 5px !important;
}

.cx-padding-left-15 {
  padding-left: 15px !important;
}

.cx-padding-left-25 {
  padding-left: 25px !important;
}

.cx-padding-right-0 {
  padding-right: 0px !important;
}

.cx-padding-right-5 {
  padding-right: 5px !important;
}

.cx-padding-right-15 {
  padding-right: 15px !important;
}

.cx-padding-right-50 {
  padding-right: 50px !important;
}

.cx-padding-top-5 {
  padding-top: 5px !important;
}

.cx-padding-top-25 {
  padding-top: 25px !important;
}

.cx-padding-top-50 {
  padding-top: 50px !important;
}

.cx-padding-bottom-5 {
  padding-bottom: 5px !important;
}

.cx-padding-bottom-25 {
  padding-bottom: 25px !important;
}

.cx-padding-bottom-50 {
  padding-bottom: 50px !important;
}

.cx-padding-none {
  padding: 0px !important;
}

.cx-padding-2 {
  padding: 2px !important;
}

.cx-padding-5 {
  padding: 5px !important;
}

.cx-padding-15 {
  padding: 15px !important;
}

.cx-padding-50 {
  padding: 50px !important;
}

.cx-border-primary-1 {
  border-style: solid;
  border-color: var(--primary-color);
  border-width: 1px;
}

.cx-border-primary-5 {
  border-style: solid;
  border-color: var(--primary-color);
  border-width: 1px;
}

// margins

.cx-margin-auto {
  margin: auto !important;
}

.cx-margin-left-5 {
  margin-left: 5px !important;
}

.cx-margin-right-5 {
  margin-right: 5px !important;
}

.cx-margin-right-50 {
  margin-right: 50px !important;
}

.cx-margin-bottom-5 {
  margin-bottom: 5px !important;
}

.cx-footer-margin {
  margin-bottom: 35px !important;
}

.cx-margin-none {
  margin: 0px !important;
}

.cx-margin-2 {
  margin-left: 2px;
  margin-right: 2px;
}

.cx-margin-10 {
  margin: 10px;
}

// table column widths

.cx-table-column-medium {
  width: $cx-column-medium;
  max-width: $cx-column-medium;
}

// table rows

th {
  background-color: var(--accent-darker-color);
  color: var(--text-accent-darker-color);
  font-weight: bolder;
}

.mat-mdc-row:nth-child(odd) {
  color: var(--mat-table-row-item-label-text-color);
  background-color: var(--mat-table-background-color);
}

.mat-mdc-row:nth-child(even) {
  filter: brightness(98%);
}

.mat-mdc-row.cx-selected-row {
  filter: brightness(90%);
}

.mat-mdc-row:hover {
  border: solid var(--mat-table-row-item-outline-color);
}

// text layout

.cx-text-nowrap {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cx-table-thumbnail {
  height: 100%;
  overflow-y: hidden;
}

// component position

.cx-position-absolute {
  position: absolute !important;
}

.cx-position-relative {
  position: relative !important;
}

.cx-bottom-5 {
  bottom: 5px !important;
}

.cx-right-5 {
  right: 5px !important;
}

.cx-centered {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.cx-centered-horiz {
  display: flex;
  justify-content: center;
  align-items: center;
}

// content display

.cx-spacer {
  flex: 1 1 auto;
}

.cx-action-button-container-vertical {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.cx-action-button-container-horizontal {
  display: flex;
  flex-direction: row;
}

.cx-detail-label {
  width: 200px;
  font-weight: bold;
  font-size: larger;
}

.cx-float-left {
  float: left;
}

.cx-align-content-center {
  text-align: center !important;
}

.cx-align-text-left {
  text-align: left !important;
}

.cx-align-left {
  margin-left: 0;
  margin-right: auto;
}

.cx-align-text-right {
  text-align: right !important;
}

.cx-align-right {
  margin-left: auto;
  margin-right: 0;
}

.cx-detail-card-container {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
}

.cx-detail-card {
  position: relative;
  display: inline-block;
}

.mat-mdc-card {
  padding-left: 0px !important;
  padding-right: 0px !important;
}

.cx-detail-card-selected {
  filter: sepia(100%) !important;
}

.cx-detail-card-blurred {
  filter: grayscale(75%);
  filter: blur(3px);
}

// flexible containers

.cx-fab-container-upper-left {
  top: 50px;
  left: 50px;
}

.cx-fab-container-upper-right {
  top: 50px;
  right: 50px;
}

.cx-fab-container-bottom-left {
  bottom: 50px;
  left: 50px;
}

.cx-fab-container-bottom-right {
  bottom: 50px;
  right: 50px;
}

.cx-fab-container-upper-right,
.cx-fab-container-bottom-left,
.cx-fab-container-bottom-right {
  position: fixed;
  cursor: pointer;
  z-index: 99;
}

.cx-horizontal-container {
  display: flex;
  flex-direction: row;
}

.cx-vertical-container {
  display: flex;
  flex-direction: column;
}

.cx-grow-20p {
  flex-basis: 20%;
}

.cx-grow-25p {
  flex-basis: 25%;
}

.cx-grow-75p {
  flex-basis: 75%;
}

.cx-grow-0 {
  flex-grow: 0;
}

.cx-grow-1 {
  flex-grow: 1;
}

// buttons

.mat-mdc-button,
.mat-mdc-icon-button,
.mat-mdc-outlined-button,
.mat-mdc-unelevated-button {
  overflow-y: hidden !important;
}

.cx-toolbar-button {
  margin-right: 5px !important;
}

.cx-toolbar-link {
  background-color: var(--primary-color) !important;
  color: var(--text-primary-color) !important;
  text-decoration: none;
}

.cx-toolbar-link-active {
  color: var(--text-accent-color) !important;
}

.cx-action-button,
tsm-confirmation button {
  min-width: 100px !important;
  padding-bottom: 5px !important;
  margin-left: 5px !important;
  overflow-x: hidden !important;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@keyframes cx-button-spinner {
  to {
    transform: rotate(360deg);
  }
}

.cx-spinner:before {
  content: '';
  box-sizing: border-box;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  margin-left: -10px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  border-top-color: #000000;
  animation: cx-button-spinner 0.8s linear infinite;
}

// alerts

.cx-info-alert {
  background: var(--accent-color);
  color: var(--text-accent-color);

  button {
    background: var(--accent-lighter-color);
    color: var(--text-accent-lighter-color);
    font-weight: bold;
  }
}

.cx-error-alert {
  background: var(--warn-color);
  color: var(--text-warn-color);

  button {
    background: var(--warn-lighter-color);
    color: var(--text-warn-lighter-color);
    font-weight: bold;
  }
}

// workarounds

mat-toolbar.mat-toolbar mat-form-field.mat-mdc-form-field {
  font-size: medium;
  /* TODO(mdc-migration): The following rule targets internal classes of form-field that may no longer apply for the MDC version.*/
  label.mat-form-field-label {
    font-weight: lighter;
  }
}

.cx-file-input {
  display: none;
}

.mat-mdc-dialog-surface {
  padding: 15px !important;
}

.cx-z-index-99 {
  z-index: 99;
}
