/*******************************************************************************
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2018, 2019. All Rights Reserved.
 *
 * US Government Users Restricted Rights - Use, duplication or disclosure 
 * restricted by GSA ADP Schedule Contract with IBM Corp.
 *******************************************************************************/
@import 'node_modules/carbon-components/scss/globals/scss/_colors';
@import 'variables';

$overview-heat-collapsed: 120px !default;
$heatmap-selection-container-width-value: 180;

/* *********************  heat map card ************************ */

.heat-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(#{$overview-column-width} * 156 - #{$overview-card-margin-right});

  .heatMapSelections {
    display: flex;

    .heatMapSelectionContainer {
      display: flex;
      flex-direction: row;
      padding: 5px 10px;
      margin: 0 4px;
      background-color: $mcm_background_color;
      width: $heatmap-selection-container-width-value + px;
      line-height: 18px;

      > label {
        font-size: 12px;
        font-weight: bold;
        width: max-content;
        display: inline-table;
      }

      .bx--dropdown {
        box-shadow: none;
      }

      .bx--list-box {
        height: 16px;
        font-weight: normal;
        &__field {
          padding: 3px;
        }
        &__field:focus, &__field[aria-expanded="true"] {
          box-shadow: none;
        }
        &__label {
          width: max-content;
          font-size: 12px;
          font-weight: normal;
        }
        &__menu {
          display: inline-table;
          left: auto;
          width: ($heatmap-selection-container-width-value - 10) + px;
          &-icon {
            padding: 0;
          }
          &:hover, &-item--highlighted {
            text-decoration: none;
          }
        }
        &__field[aria-expanded="true"] ~ .bx--list-box__menu {
          box-shadow: 3px 3px 3px 3px rgba(0, 0, 0, 0.1);
        }
      }
    }
  }

  .heat-card-container {
    height: 100%;
    width: 100%;
    padding: 3px;

    .heat-card-header {
      position: relative;
      height: 61px;
      font-size: 12px;
      font-weight: bold;
      display: flex;
      align-items: center;
      border-bottom: 1px solid #dfe3e6;
      cursor: move;
      justify-content: space-between;
      padding: 0 15px;

      &-legends {
        display: flex;
        > h6 {
          all: inherit;
          &:first-child {
            margin-left: 9px;
            margin-right: 40px;
          }
        }
        .used-by-type {
          font-weight: 400;
        }
      }

      .legend-container {
       display: flex;
       margin-left: 15px;
       font-weight: normal;

       .legend {
          width: 10px;
          height: 10px;
          margin-right: 5px;
          &.above {
            background-color: $mcm_heat_red;
          }
          &.average {
            background-color: $mcm_heat_yellow;
          }
          &.below {
            background-color: $mcm_heat_blue;
          }
        }
      }
    }

    .heat-card-toggle {
      position: absolute;
      top: 75px;
      right: 15px;
      color: $color__blue-51;
      cursor: pointer;
      padding: 3px 3px 0 3px;
      outline: none;
      font-weight: bold;
      font-size: 12px;
    }

    .heat-card-map {
      width: 100%;
      position: relative;
    }
  }

  &.collapsed {
    .heat-card-container {
      position: relative;
    }

    .heat-card-map {
      height: $overview-heat-collapsed;
      margin-top: 46px;
      padding: 0 10px;
    }
  }

  &.expanded {
    .heat-card-container {
      display: flex;
      flex-direction: column;
    }

    .heat-card-map {
      margin-top: 26px
    }
 }
}

/* *********************  collapsed ************************ */

svg.heatMap {
  height: 100%;
  width: 100%;

  .grid {
    stroke: none;
    fill: none;
  }

  .square-red {
    stroke: none;
    fill: $mcm_heat_red;
  }

  .square-yellow {
    stroke: none;
    fill: $mcm_heat_yellow;
  }

  .square-blue {
    stroke: none;
    fill: $mcm_heat_blue;
  }

  .square-white {
    stroke: none;
    fill: $color__white;
  }

}

/* *********************  expanded ************************ */

div.heatMap {
  display: flex;
  justify-content: space-evenly;
  padding: 20px;

  .heatMapSection {
    display: flex;
    flex-direction: column;
    margin-right: 20px;

    .heatMapLabel {
      font-size: 16px;
      font-weight: bold;
      padding-bottom: 5px;
    }

    .heatMapContent {
       width: 100%;
       height: 100%;

      .masonry-class {
         width: 100%;
         height: 100%;

         .grid-sizer {
           width: 2%;
         }

         .heat-item {
           margin-bottom: 5px;
           cursor: default;

           .cluster-name {
             font-size: 12px;
             padding: 5px;
             color: $color__navy-gray-3;
           }

            &.square-red {
              background-color: $mcm_heat_red;
            }
            &.square-yellow {
              background-color: $mcm_heat_yellow;
            }
            &.square-blue {
              background-color: $mcm_heat_blue;
            }

            .heatTooltip {
              width: 100%;
              height: 100%;
            }

         }
      }
    }
  }
}

.bx--tooltip {
  padding: 10px;
}

.bx--tooltip div {
  margin: 0;
  align-items: flex-start;
}

.bx--tooltip div.bx--tooltip__footer {
  padding-top: 10px;
  white-space: nowrap;
  justify-content: flex-end;
  min-width: 150px;
}

.heat-tooltip {
  display: flex;
  flex-direction: column;
  width: fit-content;
  height: fit-content;
  cursor: default;
  margin:0;

  .tooltip-line {
    height: 18px;
    padding:0;
    margin:0;
    font-size: 14px;
    display: flex;
    white-space: nowrap;

    .label {
      color: $color__navy-gray-6;
      padding-right: 5px;
    }

    .value {
      font-weight: bold;
      color: $color__blue-90;
     }
  }
}

