// (C) Copyright 2020 Hewlett-Packard Enterprise Company, L.P.

div.hp-grid-panels {
  position: absolute;
  top: 0px;
  bottom: 0px;
  left: 0px;
  right: 0px;
  overflow: hidden;
  
  div.hp-grid-row {
    white-space: nowrap;
    overflow: visible;
    
    > div.hp-grid-panel, > div.hp-grid-column {
      display: inline-block;
      vertical-align: top;
      white-space: normal;
      margin-right: -4px;
    }
  }
  
  div.hp-grid-column {
    white-space: normal;
    overflow: visible;
    display: inline-block;
    
    > div.hp-grid-panel, > div.hp-grid-row {
      display: block;
    }
  }
  
  div.hp-grid-panel {
    position: relative;
    @include box-sizing(border-box);
    padding: 15px;
    -moz-background-clip:padding-box !important;
    -webkit-background-clip:padding-box !important;
    -ms-background-clip:padding-box !important;
    -o-background-clip:padding-box !important;
    background-clip:padding-box !important;
    overflow: hidden;
    
    &.hp-secondary {
      background-color: $secondary-background;
    }
    
    > header {
      position: relative;
      margin: 0px 0px 17px 0px;
      padding: 0px;
      height: 30px;
      line-height: 30px;
      color: #000;
      font-family: 'HPRegular', Arial, Helvetica, sans-serif;
      border-top: 3px solid $secondary-divider;
      @include transition(border-color, $appearance-duration);
      
      html.hp-high-contrast & {
        color: $projection-secondary-color;
      }
      
      > * {
        display: inline-block;
        vertical-align: baseline;
      }
      
      h2 {
        margin: 0px -4px 0px 0px;
        padding: 0px;
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-size: 18px;
        font-family: 'HPBold', Arial, Helvetica, sans-serif;
        a {
          color: #000;
          &:after {
            content: ' >';
            color: $text-link-color;
            cursor: pointer;
          }
          
          &:hover {
            color: $text-link-color;
            text-decoration: none;
            
            &:after {
              content: ' >';
              color: $text-link-color;
            }
          }
          
          .hp-count {
            color: $secondary-color;
            padding-left: 3px;
            font-family: 'HPRegular', Arial, Helvetica, sans-serif;
          }
        }
      }
      
      .hp-panel-edit {
        padding-left: 15px;
        margin-left: 20px;
        vertical-align: top;
        background-image: $edit-url;
        background-position: -4px 4px;
        background-repeat: no-repeat;
        opacity: 0;
        @include transition(opacity, $appearance-duration);
      }
      
      .hp-resource-summary {
        margin-left: 5px;
        font-size: 18px;
      }
    }
    
    &:hover {
      > header {
        border-color: #b3b3b3;
      }
      
      .hp-panel-edit { // not in IE8 :not(.hp-unauthorized) {
        opacity: 1;
        
        &.hp-unauthorized {
          display: none;
        }
      }
    }
    
    .hp-panel-contents-container {
      position: relative;
      overflow: auto;
      @include box-sizing(border-box);
      
      .hp-panel-contents {
        position: static;
        
        > *:last-child, .hp-show-form > fieldset > ol:last-child {
          margin-bottom: 0px;
        }
        .hp-pie-summary {
          margin-top: 10px;
        }
      }
    }
    
    .hp-panel-contents {
      
      &.hp-panel-table {
        
        table {
          width: 100%;
          td:first-of-type, th:first-of-type {
            padding-left: 20px;
          }
        }
      }
      
      > *, table {
        max-width: 100%;
      }
      
      .hp-column-form {
        float: none;
        padding-bottom: 0px;
      }
      
      .hp-section {
        margin-bottom: 10px;
      }
      
      &.hp-grid-column {
        width: 100%;
        height: 100%;
        
        > .hp-grid-panel {
          padding: 15px 0px;
          overflow: visible;
          width: 100%;
          
          &:first-child {
            padding-top: 0px;
          }
          
          &:last-child {
            padding-bottom: 0px;
          }
          
          > *:last-child {
            margin-bottom: 0px;
          }
        }
      }
      
      &.hp-grid-row {
        width: 100%;
        height: 100%;
        
        > .hp-grid-panel {
          padding: 0px 15px;
          overflow: visible;
          height: 100%;
          
          &:first-child {
            padding-left: 0px;
          }
          
          &:last-child {
            padding-right: 0px;
          }
          
          > *:last-child {
            margin-bottom: 0px;
          }
        }
      }
      
      @media print {
        position: static;
        margin: 0px;
        width: auto !important;
        height: auto !important;
      }
    }
    
    .hp-panel-controls {
      position: absolute;
      left: 15px;
      right: 15px;
      bottom: 0px;
      background-color: $primary-background;
      margin-bottom: 0px;
      padding-bottom: 15px;
    }
    
    @media print {
      @include print-position();
      display: block !important;
      width: auto !important;
      height: auto !important;
      background-image: none;
    }
  }
  
  &.hp-grid-narrow {
    position: static;
    overflow: auto;
    
    .hp-grid-row, .hp-grid-column, .hp-grid-panel {
      display: block;
      width: 100%;
      white-space: normal;
    }
    div.hp-grid-row {
      display: block;
      width: 100%;
      white-space: normal;
      overflow: auto;

      > div.hp-grid-panel, > div.hp-grid-column {
        display: block;
        vertical-align: baseline;
        white-space: normal;
        margin: 0px;
      }
    }

    div.hp-grid-column {
      display: block;
      width: 100%;
      white-space: normal;
      overflow: auto;

      > div.hp-grid-panel, > div.hp-grid-row {
        display: block;
      }
    }
    
    .hp-panel-contents {
      position: static;
    }
  }
  
  &.hp-scaled-panels div.hp-grid-panel {
    .hp-panel-contents-container {
      overflow: hidden;
    }
  }
  
  > canvas { // only used for development
    position: absolute;
    top: 0px;
    left: 0px;
    opacity: 0.5;
    pointer-events: none;
  }
  
  @media print {
    @include print-position();
  }
}

.hp-secondary-panel {
  background-color: $secondary-background;
}

div.hp-related {
  > canvas {
    position: absolute;
  }
}

ol.hp-buckets {
  li.hp-bucket {
    position: relative;
    background-image: $horizontal-dot-url;
    background-position: left bottom;
    background-repeat: repeat-x;
    padding: 10px 0px;
    
    &:last-of-type {
      background: none;
    }
    
    > label {
      position: absolute;
      right: 10px;
      top: 19px;
      width: 76px;
      color: $secondary-color;
      white-space: normal;
      text-align: right;
    }
    
    ol.hp-bucket-items {
      position: relative;
      white-space: nowrap;
      margin-right: 100px;
      overflow: hidden;
      text-align: center;
      
      li.hp-bucket-item {
        position: relative;
        display: inline-block;
        margin-right: 5px;
        background-color: $primary-background;
        padding: 8px;
        min-width: 140px;
        white-space: nowrap;
        cursor: pointer;
        border: 2px solid #ccc;
        border-top-right-radius: 7px;
        border-bottom-left-radius: 7px;
        @include transition(opacity, $appearance-duration);
        
        &:hover {
          z-index: 10;
        }
        
        &.hp-selected {
          background-color: $selected-background;
        }
        
        &.hp-selection-related {
          border-color: #7fbfda;
        }
        
        &.hp-highlight {
          border-color: $highlight-border;
          z-index: 5;
        }
        
        .hp-status {
          position: relative;
          display: inline-block;
          height: 14px;
          top: 2px;
        }
        .hp-name {
          display: inline-block;
          vertical-align: top;
          color: #000;
        }
        .hp-model {
          color: $secondary-color;
          padding-left: 18px;
          padding-right: 20px;
        }
        .hp-jump {
          position: absolute;
          bottom: 0px;
          right: 0px;
          display: none;
        }
        .hp-category-name {
          color: #000;
          margin-bottom: 3px;
        }
        .hp-summary-status {
          .hp-status {
            top: 4px;
          }
        }
        
        &:hover {
          border-color: $grid-item-outline-hover;
          
          .hp-jump {
            //display: block;
          }
        }
      }
    }
  }
  
  &.hp-has-highlight, &.hp-disabled {
    .hp-bucket-item {
      opacity: 0.4;
      &.hp-highlight {
        opacity: 1.0;
      }
    }
  }
}

ol.hp-stacked-panels {
  height: 100%;
  overflow: auto;
    
  > li.hp-stacked-panel {
    margin-bottom: 20px;
    
    &:first-child {
      > label {
        border-top: none;
        border-bottom: 1px solid $primary-divider;
      }
    }
    
    &:last-child {
      margin-bottom: 0px;
    }
    
    > * { // IE needs this :(
      ///border: none;
    }
    
    &:hover {
      > label .hp-panel-edit {
        opacity: 1;
        
        &.hp-unauthorized {
          display: none;
        }
      }
    }
    
    &.hp-active {
      padding-top: 56px;
      
      > label {
        position: absolute;
        left: 0px;
        right: 0px;
        border-top: none;
        border-bottom: 1px solid #e6e6e6;
        
        @media print {
          position: relative;
          border-top: 1px solid #e6e6e6;
          border-bottom: none;
        }
      }
    }
    
    > label {
      position: relative;
      display: block;
      font-size: 18px;
      color: #000;
      top: 0px;
      z-index: $header-z-index - 5;
      background-color: #fff;
      background-color: rgba(255, 255, 255, 0.9);
      padding-top: 10px;
      padding-bottom: 10px;
      margin-bottom: 20px;
      border-top: 1px solid #e6e6e6;
      font-family: 'HPBold', Arial, Helvetica, sans-serif;
      
      html.hp-high-contrast & {
        color: $projection-secondary-color;
      }
      
      .hp-panel-edit {
        padding-left: 15px;
        margin-left: 20px;
        font-family: 'HPRegular', Arial, Helvetica, sans-serif;
        font-size: $body-font-size;
        background-image: $edit-url;
        background-position: -4px -3px;
        background-repeat: no-repeat;
        opacity: 0;
        @include transition(opacity, $appearance-duration);
      }
    }
    
    > ol, > ul {
      margin-bottom: 20px;
    }
    
    > .hp-panel-contents {
      
      > .hp-column-form {
        display: inline-block;
        width: auto;
        vertical-align: top;
      }
      
      > .hp-panel-aside {
        display: inline-block;
        vertical-align: top;
        margin: 0px 20px 0px 60px;
        padding: 20px;
        background: #f8f8f8;
        border-left: 3px solid #eee;
        border-radius: 3px;
        
        .hp-column-form {
          padding: 0px;
          
          fieldset:last-of-type {
            margin-bottom: 0px;
          };
        }
      }
    }
    
    &.hp-stacked-panel-notification {
      
      &.hp-active {
        padding-top: 0px;
      }
      
      > label {
        padding: 0px;
        margin: 0px;
      }
      
      > .hp-dialog-notification {
        margin: 15px 30px 0px 30px;
      }
    }
    
    @media print {
      @include print-position();
      height: auto !important;
    }
  }
  
  @media print {
    @include print-position();
    height: auto !important;
  }
}

.hp-rich-enumeration {
  > li {
    > * {
      padding-left: 20px;
    }
    
    > table td:first-of-type {
      padding-left: 20px;
    }
    
    > h2 {
      border-top: 1px solid $primary-divider;
      padding: 7px 20px;
      color: $secondary-color;
      
      html.hp-high-contrast & {
        color: $projection-secondary-color;
      }
    }
  }
}
