@import '../../style/variables.scss';

@font-face {
  font-family: 'icomoon';
  font-style: normal;
  font-weight: normal;
  src: url('../../fonts/icomoon.eot') format('embedded-opentype');
  src: url('../../fonts/icomoon.eot') format('embedded-opentype'),
    url('../../fonts/icomoon.woff2') format('woff2'),
    url('../../fonts/icomoon.ttf') format('truetype'),
    url('../../fonts/icomoon.woff') format('woff'),
    url('../../fonts/icomoon.svg') format('svg');
}

.time-machine-tables {
  align-items: stretch;
  display: flex;
  flex-wrap: nowrap;
  height: 100%;
  width: 100%;
}

.time-machine-sidebar {
  background-color: $table-graph--cell;
  border-radius: 4px;
  border: 2px solid $table-graph--border;
  flex: 1 0 180px;
  margin-right: 4px;
  overflow: hidden;
}

.time-machine-sidebar--heading {
  background: $table-graph--heading-bg--active;
  box-sizing: border-box;
  height: 50px;
  padding: 10px;
}

.time-machine-sidebar--scroll {
  box-sizing: border-box;
  height: calc(100% - 50px) !important;
}

.time-machines-sidebar--filter.form-control.cf-input-xs {
  font-size: 12px;
}

.time-machine-sidebar--items {
  display: inline-flex;
  flex-direction: column;
  width: 100%;
}

@mixin no-user-select() {
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  -o-user-select: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  &,
  &:hover {
    cursor: default;
  }
}

.time-machine-sidebar-item {
  @include no-user-select();
  color: $table-graph--text-color;
  font-size: $table-graph--font;
  font-weight: 400;
  padding: 8px 8px;
  transition: color 0.25s ease, background-color 0.25s ease;
  white-space: nowrap;

  > span {
    padding-right: 2px;
  }

  > span.key,
  > span.equals {
    color: rgba($table-graph--text-color, 70%);
  }

  > span.value {
    color: $table-graph--text-color;
    font-weight: 500;
    padding-right: 8px;
  }

  &:hover {
    background-color: $table-graph--cell-highlight;
    color: $table-graph--text-color;
    cursor: pointer;

    > span.key,
    > span.equals {
      color: $table-graph--text-color;
    }

    > span.value {
      color: $table-graph--text-highlight;
    }
  }

  &.active {
    background-color: $table-graph--heading-bg--active;
    color: $table-graph--text-highlight;

    > span.key,
    > span.equals {
      color: $table-graph--text-highlight;
    }

    > span.value {
      color: $table-graph--heading-sort;
    }
  }
}

.time-machine-table {
  border-radius: 4px-sm;
  border: 2px solid $table-graph--border;
  flex: 4 0 100px;
  overflow: hidden;

  &:only-child {
    border: 1;
  }
}

/*
    Table Type Graphs in Dashboards
    ----------------------------------------------------------------------------
*/

.table-graph-cell {
  -moz-user-select: text !important;
  -o-user-select: text !important;
  -webkit-user-select: text !important;
  background-color: $table-graph--cell;
  border: (2px * 0.5) solid $table-graph--border;
  box-sizing: border-box;
  color: $table-graph--text-color;
  font-size: $table-graph--font;
  font-weight: 500;
  line-height: 28px; // Cell height - 2x border width
  overflow: hidden;
  padding: 0 6px;
  text-overflow: ellipsis;
  user-select: text !important;
  white-space: nowrap;

  &__highlight-row {
    background-color: $table-graph--cell-highlight;
    color: $table-graph--text-highlight;
  }
  &__numerical {
    font-family: 'IBMPlexMono', monospace;
    text-align: right;
  }
  &__fixed-row,
  &__fixed-column {
    background-color: $table-graph--heading-bg;
    color: $table-graph--heading-text;
    font-weight: 700;
  }
  &__fixed-row {
    border-top: 0;
  }
  &__fixed-column {
    border-left: 0;
  }
  &__fixed-corner {
    background-color: $table-graph--heading-bg--active;
    border-left: 0;
    border-top: 0;
    color: $table-graph--heading-text-corner;
    font-weight: 700;
  }
  &__field-name {
    padding-right: 17px;

    &:before {
      content: '\e912';
      font-family: 'icomoon';
      font-size: 13px;
      font-size: 17px;
      opacity: 0;
      position: absolute;
      right: 6px;
      top: 50%;
      transform: translateY(-50%) rotate(180deg);
      transition: opacity 0.25s ease, color 0.25s ease, transform 0.25s ease;
    }
    &:hover {
      cursor: pointer;
    }
    &:hover:before {
      opacity: 1;
    }
  }
  &__sort-asc,
  &__sort-desc {
    color: $table-graph--heading-sort;

    &:before {
      opacity: 1;
    }
  }
  &__sort-asc:before {
    transform: translateY(-50%) rotate(180deg);
  }
  &__sort-desc:before {
    transform: translateY(-50%) rotate(0deg);
  }
}

/*
    Light Mode
    ----------------------------------------------------------------------------
*/

.time-machine-table.time-machine-table__light-mode {
  border-color: $table-light-graph--border;

  .table-graph-cell {
    background-color: $table-light-graph--cell;
    border-color: $table-light-graph--border;
    color: $table-light-graph--text-color;

    &__highlight-row {
      background-color: $table-light-graph--cell-highlight;
      color: $table-light-graph--text-highlight;
    }
    &__fixed-row,
    &__fixed-column {
      background-color: $table-light-graph--heading-bg;
      color: $table-light-graph--heading-text;
    }
    &__fixed-corner {
      background-color: $table-light-graph--heading-bg--active;
      color: $table-light-graph--heading-text-corner;
    }
    &__sort-asc,
    &__sort-desc {
      color: $table-light-graph--heading-sort;
    }
  }
}

.time-machine-sidebar.time-machine-sidebar__light {
  background-color: $table-light-graph--cell;
  border-color: $table-light-graph--border;

  .time-machine-sidebar--heading {
    background: $table-light-graph--heading-bg--active;
  }

  .time-machine-sidebar-item {
    color: $table-light-graph--text-color;

    > span.key,
    > span.equals {
      color: rgba($table-light-graph--text-color, 70%);
    }

    > span.value {
      color: $table-light-graph--text-color;
    }

    &:hover {
      background-color: $table-light-graph--cell-highlight;
      color: $table-light-graph--text-color;

      > span.key,
      > span.equals {
        color: $table-light-graph--text-color;
      }

      > span.value {
        color: $table-light-graph--text-highlight;
      }
    }

    &.active {
      background-color: $table-light-graph--heading-bg--active;
      color: $table-light-graph--text-highlight;

      > span.key,
      > span.equals {
        color: $table-light-graph--text-highlight;
      }

      > span.value {
        color: $table-light-graph--heading-sort;
      }
    }
  }

  .cf-input.time-machine-sidebar--filter > input {
    background-color: #f6f6f8;
    border-color: #d4d7dd;
    color: #545667;

    &::-webkit-input-placeholder {
      color: #d4d7dd;
    }
    &::-moz-placeholder {
      color: #d4d7dd;
    }
    &:-ms-input-placeholder {
      color: #d4d7dd;
    }
    &:-moz-placeholder {
      color: #d4d7dd;
    }

    &:focus {
      background-color: #ffffff;
      border-color: #00a3ff;
    }
  }
  .cf-input.time-machine-sidebar--filter:hover > input {
    background-color: #ffffff;
    border-color: mix(#d4d7dd, #00a3ff, 50%);
  }

  .cf-input.cf-input__focused.time-machine-sidebar--filter > .cf-input-icon {
    color: #00a3ff;
  }

  .time-machine-sidebar--scroll .cf-dapper-scrollbars--track-y {
    background-color: #d4d7dd !important;
  }
}
