// Copyright 2017 The Kubernetes Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
@import './dark';
@import './light';
@import './variables';
@import './mixins';

/////////////////////////////////
// Overrides of default styles //
/////////////////////////////////

html,
body {
  height: 100%;
  margin: 0;
}

a {
  text-decoration: none;
}

button {
  &:not(:last-child) {
    margin-right: $baseline-grid;
  }
}

code {
  font-family: $font-family-monospace;
  padding: .25 * $baseline-grid;
}

* {
  &::-webkit-scrollbar {
    background: transparent;
    height: $baseline-grid;
    width: $baseline-grid;
  }
}

//////////////////////////////////////////
// Overrides of Angular Material styles //
//////////////////////////////////////////

.mat-progress-spinner {
  margin: 0 auto;
}

.mat-card {
  margin: 2.5 * $baseline-grid;

  .mat-card-title {
    margin-bottom: $baseline-grid;
  }

  .mat-card-content {
    padding-top: 2 * $baseline-grid;
  }
}

.mat-chip.mat-standard-chip {
  box-shadow: none !important;
  font-size: $body-font-size-base;
  font-weight: $regular-font-weight;
  height: fit-content;
  line-height: $body-font-size-base;
  min-height: unset;
  padding: ($baseline-grid * .75) ($baseline-grid * 1.25);
  transition: none !important;
  word-break: break-all !important;

  &:hover::after {
    opacity: 0 !important;
  }

  &:focus::after {
    opacity: 0 !important;
  }
}

.mat-header-row,
.mat-row {
  min-height: (5 * $baseline-grid) !important;
  padding: 0 (2 * $baseline-grid) !important;
}

.mat-header-cell {
  font-size: $body-font-size-base;
  padding: 0 ($baseline-grid / 2);

  &:first-child,
  &:last-child {
    padding: 0 !important;
  }
}

.mat-cell {
  margin: (.5 * $baseline-grid) 0 !important;

  &:not(:first-child) {
    &:not(:last-child) {
      padding: 0 ($baseline-grid / 2);
    }
  }

  &:last-child {
    padding-right: 0 !important;
  }

  &:first-child {
    padding-left: 0 !important;
  }
}

.mat-column-statusicon {
  flex: 0 0 ($baseline-grid * 5) !important;
}

.mat-column-labels,
.mat-column-images,
.mat-column-name,
.mat-column-message {
  flex-grow: 2 !important;
}

[class^='mat-column-action'],
[class*='mat-column-action'] {
  flex: 0 0 ($baseline-grid * 5) !important;
}

.mat-sort-header-arrow {
  align-self: center;
}

.mat-paginator-container,
.mat-paginator-range-actions {
  font-size: $body-font-size-base;
  min-height: 5 * $baseline-grid !important;
}

.mat-paginator-container {
  padding-right: 3 * $baseline-grid !important;
}

.mat-button-toggle-group {
  border-bottom: 0 !important;
  box-shadow: none !important;
}

router-outlet::after {
  padding: 0 !important;
}

////////////////////////////////////////////
// Custom classes used across application //
////////////////////////////////////////////

.kd-equivalent-block {
  border-radius: $baseline-grid / 4;
  font-size: $body-font-size-base;
  margin: (1.5 * $baseline-grid) 0;
  padding: $baseline-grid;

  mat-icon {
    @include kd-icon-size(3 * $baseline-grid);

    margin-right: $baseline-grid;
  }
}

.kd-dialog-text {
  font-family: $font-family-sans;
  padding-bottom: .5 * $baseline-grid;
  padding-top: 0;
}

.kd-toolbar-action {
  margin: 0 (.75 * $baseline-grid) !important;
}

.kd-code-block {
  border-radius: $baseline-grid / 4;
  display: block;
  font-family: $font-family-monospace;
  font-size: $body-font-size-base;
  padding: $baseline-grid * 2;
  white-space: pre-wrap;
}

.kd-code-block-font {
  font-size: $body-font-size-base;
}

.kd-minimized-card {
  margin: 0 (2.5 * $baseline-grid);
  outline: none;

  &.mat-card {
    border-radius: 0;
  }
}

.kd-inline-property {
  display: inline-flex;
  margin-right: 3 * $baseline-grid;
}

.kd-card-group-header {
  font-family: $font-family-sans;
  font-size: $title-font-size-base;
  margin: (3 * $baseline-grid) 0 (2.5 * $baseline-grid) (4.5 * $baseline-grid);
}

.kd-card-top-radius {
  border-top-left-radius: .25 * $baseline-grid;
  border-top-right-radius: .25 * $baseline-grid;
}

.kd-bold {
  font-weight: $bold-font-weight;
}

.kd-h1 {
  font-size: 24px;
}

.kd-h3 {
  font-size: 16px;
}

.kd-card-padding {
  padding: 2.5 * $baseline-grid;
}

.kd-no-margin {
  margin: 0;
}

.kd-margin-bottom {
  margin-bottom: $baseline-grid;
}

.kd-margin-right {
  margin-right: $baseline-grid;
}

.kd-slider-value {
  font-size: $subhead-font-size-base-lg;
  text-align: right;
  width: 2 * $baseline-grid;
}

.kd-comma-separated-item {
  display: inline-block;

  &:not(:last-child) {
    &::after {
      content: ',';
    }
  }
}

.kd-pre-block {
  margin: 0;
  min-width: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.kd-loading-shade {
  align-items: center;
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
}

.kd-chips-show-button {
  cursor: pointer;
  font-size: $body-font-size-base;
  font-weight: $regular-font-weight;
  height: fit-content;
  line-height: $body-font-size-base;
  padding: ($baseline-grid * .75) ($baseline-grid * 1.75);
}

.kd-on-top {
  z-index: 100;
}

.kd-clickable {
  cursor: pointer !important;
}

.kd-no-bottom-border {
  border-bottom: 0 !important;
}

.kd-sparkline {
  height: 4 * $baseline-grid;
  vertical-align: -$baseline-grid / 2; // 20% below baseline, to flow with text
  width: 15 * $baseline-grid;
}

.kd-sparkline-value {
  font-weight: $bold-font-weight;
  position: absolute;
}

.mat-column-cpu,
.mat-column-mem {
  min-width: 15 * $baseline-grid;
}

// This is a workaround to remove whitespace from code block element.
.kd-no-whitespace {
  font-size: 0;
}

.kd-hidden {
  display: none !important;
}

.kd-table-no-footer {
  .mat-row:last-of-type {
    border-bottom: 0;
  }
}

// Override Arial font type
.nvtooltip {
  font-family: Roboto, sans-serif;
}
