//! (C) Copyright 2011-2013 Hewlett-Packard Development Company, L.P.

@import "hp-piano-mixins";

div.hp-grid-panels {
  position: absolute;
  top: 0px;
  bottom: 0px;
  left: 0px;
  right: 0px;
  overflow: hidden;
  
  div.hp-grid-row {
    white-space: nowrap;
    overflow: hidden;
    
    > 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: nowrap;
    overflow: hidden;
    
    > 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;
        padding: 0px;
        max-width: 80%;
        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; //#b2b2b2;
            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; ///height: 20px;
        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-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;
      }
      
      @media print {
        position: static;
        margin: 0px;
        width: auto !important;
        height: auto !important;
      }
      
      &.hp-panel-contents-grid {
        margin-left: -30px;
        margin-right: -30px;
        
        .hp-grid-panel-cell {
          display: inline-block;
          margin-right: -4px;
          padding: 0px 15px;
          width: auto;
          @include box-sizing(border-box);
          
          &:first-child {
            padding-left: 30px;
          }
          &:last-child {
            padding-right: 30px;
          }
        }
      }
    }
    
    .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 {
    .hp-grid-row, .hp-grid-column, .hp-grid-panel {
      display: block;
    }
    .hp-grid-panel {
      background-image: $panel-horizontal-dot-url;
      background-position: left top;
      background-repeat: repeat-x;
    }
    .hp-panel-contents {
      position: static;
    }
  }
  
  @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;
        //border: 1px solid $grid-item-outline;
        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-of-type {
      > label {
        border-top: none;
        border-bottom: 1px solid $primary-divider;
      }
    }
    
    &:last-of-type {
      margin-bottom: 0px;
    }
    
    > * { // IE needs this :(
      ///border: 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-active {
        position: absolute;
        left: 0px;
        right: 0px; //16px;
        border-top: none;
        border-bottom: 1px solid #e6e6e6;
        
        @media print {
          position: relative;
          border-top: 1px solid #e6e6e6;
          border-bottom: none;
        }
      }
    }
    
    > 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;
          };
        }
      }
    }
    
    @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;
      }
    }
  }
}
