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

table {
  border-collapse: separate;
  border: 0px;
  border-spacing: 0px;
  
  > thead {
  
    > tr {
    
      td, th {
        background-color: $table-header-background;
        color: $table-header-color;
        padding: 5px 10px;
        font-weight: normal;
        text-align: left;
        vertical-align: baseline; //top;
        background-image: $horizontal-dot-url;
        background-position: left bottom;
        background-repeat: repeat-x;
    
        html.hp-high-contrast & {
          color: $projection-table-header-color;
        }
    
        ///&.hp-icon {
        ///  padding-right: 10px;
        ///}
    
        &:first-of-type {
          border-left: none;
        }
    
        &:last-of-type {
          border-right: none;
        }
    
        &.sorting, &.sorting_asc, &.sorting_desc, &.sort {
          cursor: pointer;
      
          &:hover {
            color: $table-header-hover-color;
          }
        }
    
        &.sorting_asc, &.sort_asc {
          background-image: $horizontal-dot-url, $sort-asc-url;
          background-position: left bottom, right 4px;
          background-repeat: repeat-x, no-repeat;
          padding-right: 20px;
      
          &:hover {
            background-image: $horizontal-dot-url, $sort-asc-over-url;
          }
        }
    
        &.sorting_desc, &.sort_desc {
          background-image: $horizontal-dot-url, $sort-desc-url;
          background-position: left bottom, right 4px;
          background-repeat: repeat-x, no-repeat;
          padding-right: 20px;
      
          &:hover {
            background-image: $horizontal-dot-url, $sort-desc-over-url;
          }
        }
    
        &:active {
          background-color: $table-header-active-background;
          color: $table-header-hover-color;
        }
    
        > .hp-status {
          position: relative;
          top: 4px; ///2px;
          width: 10px;
        }
        
        input[type="checkbox"] {
          //margin-right: 10px;
        }
    
        @media print {
          padding-left: 0px;
          border-left: none;
        }
      }
    }
  }
  
  > tbody > tr {
    
    > td {
      padding: 9px 10px; ///13px 10px;
      vertical-align: top;
      border-top: 1px solid transparent;
      border-bottom: 1px solid transparent;
      @include box-sizing(border-box);
      
      &.hp-identifier {
        min-width: 120px;
      }
      
      &.hp-icon {
        //height: 36px;
        //padding: 2px 10px 0px 10px;
        
        &.hp-numeric {
          padding-right: 0px;
          padding-left: 15px;
        }
        
        .hp-close, .hp-delete {
          position: relative;
          top: 3px; ///13px;
          cursor: pointer;
        }
        
        .hp-edit {
          position: relative;
          top: 0px;
          cursor: pointer;
        }
        
        > .hp-status {
          position: relative;
          //top: 12px;
          top: 2px;
          width: 10px;
          
          &.hp-status-changing {
            width: 14px;
          }
        }
      }
      
      &.hp-index {
        color: $secondary-color;
        padding-left: 25px;
        background-image: $reorder-url;
        background-position: 5px 8px;
        background-repeat: no-repeat;
        
        &:hover {
          cursor: move;
          cursor: -webkit-grab;
          cursor: -moz-grab;
          background-image: $reorder-over-url;
        }
        html.hp-high-contrast & {
          color: $projection-secondary-color;
        }
      }
      
      &.hp-editing {
        padding: 4px 0px;
        input {
          margin: 0px;
          padding: 7px 9px;
        }
      }
      
      > .hp-collapser {
        margin: -9px;
        background-position: 9px 7px;
        width: 35px;
        height: 35px;
      }
      
      @media print {
        padding-left: 0px;
      }
    }
  }
  
  tr.hp-row-details-row {
    background-image: none;
  }
  
  td.hp-row-details-cell {
    padding: 0px 20px 10px 50px;
    border-bottom: 1px solid $primary-divider;
    
    > .hp-full {
      margin: 0px -9px -10px -50px;
      
      table {
        margin: 0px;
      }
    }
    
    table, .hp-show-form {
      margin: 15px 0px 20px 0px;
    }
    > table, > div > table {
      width: 100%;
    }
    .hp-statistic {
      display: inline-block;
      vertical-align: top;
      margin-right: 40px;
      margin-bottom: 40px;
      
      > label {
        color: $secondary-color;
        font-size: 16px;
      }
      .hp-plot {
        width: 300px;
        height: 200px;
      }
    }
  }
  
  &.hp-outer-table {
    width: 90%;
  }
  
  .hp-row-details {
    padding-top: 10px;
    position: relative;
    background-image: $horizontal-dot-url;
    background-position: left top;
    background-repeat: repeat-x;
    
    .hp-comments-section {
      position: relative;
      text-align: left;
      min-width: 440px;
      display: inline-block;
    }
    
    .hp-show-form {
      display: inline-block;
      width: 45%;
    }
  }
  
  .hp-row-controls {
    margin-bottom: 0px;
    display: none;
    white-space: nowrap;
    
    li {
      display: inline-block;
      margin-right: 10px;
      
      &.hp-delete {
        position: relative;
        top: 1px;
      }
    }
  }
  
  tr.hp-selected {
    .hp-row-controls {
      display: block;
    }
  }
}

table.hp-simple-table {
  thead {
    display: none;
  }
  tr {
    background: none;
  }
  tbody tr td {
    padding: 5px 10px;
    &:first-of-type {
      padding-left: 0px;
    }
    
    > .hp-status {
      top: 3px;
    }
    
    > .hp-usage {
      margin-right: 10px;
    }
  }
}

.dataTables_filter input[type="text"]{
  background:
    url('../../img/hp-piano/search.png') center right no-repeat;
  background:
    url('../../img/hp-piano/search.png') center right no-repeat;
}

.dataTables_empty {
  html.hp-high-contrast & {
    color: $projection-secondary-color;
  }
}

div.dataTables_scrollBody {
  &:focus {
    outline: none;
  }
}

table.hp-selectable {
  margin: 0px;
  
  > tbody > tr {
    cursor: pointer;
    
    td {
      @include transition(background-color, $appearance-duration);
    }
    
    &:hover > td {
      background-color: #e6e6e6;
    }
    
    &.hp-selected, &.hp-selected:hover {
      > td {
        background-color: $selected-background;
      }
      
      &.hp-row-details-row {
        > td {
          border-top: none;
        }
      }
    }
    
    &.hp-expanded, &.hp-expanded:hover {
      background-image: none;

      > td {
        border-top: 1px solid $secondary-divider;
        border-bottom-style: none;

        &:first-child {
          border-left: 1px solid $secondary-divider;
          padding-left: 9px;
        }

        &:last-child {
          border-right: 1px solid $secondary-divider;
        }
      }

      &.hp-selected, &.hp-selected:hover {
        > td {

          border-top-color: $primary-divider;
          &:first-child {
            border-left: none;
            padding-left: 10px;
          }
        }
      }
    }
  }
  
  .hp-comments-summary {
    width: 38px;
    height: 24px;
    margin: -4px -3px;
    border-style: solid;
    border-width: 1px;
    border-color: transparent;
    border-radius: 3px;
    &:hover {
      border-color: #eee;
    }
  }
  .hp-selected .hp-comments-summary {
    border-color: $selected-background;
    &.hp-empty {
      opacity: 0.9;
    }
    &:hover {
      border-color: #000;
      opacity: 1.0;
    }
  }
  
  /*.hp-dropper {
    vertical-align: top;
    margin: 0px 5px;
    width: 18px;
    height: 18px;
    display: inline-block;
  }*/
  
  tr.hp-row-details-row {
    
    td.hp-row-details-cell {
      border-left: 1px solid $secondary-divider;
      border-bottom: 1px solid $secondary-divider;
      border-right: 1px solid $secondary-divider;
      border-top: none;
    }
    
    &.hp-selected {
      td.hp-row-details-cell {
        background-color: inherit;
        border-color: $primary-divider;
      }
    }
  }
}

.hp-activities {
  .hp-row-details {
    padding-left: 50px;
  }
  .hp-row-details-row.hp-selected {
    .hp-row-details {
      padding-left: 51px;
    }
  }
}

.hp-comments {
  margin-bottom: 20px;
  
  .hp-comment {
    background-image: none;
    
    td {
      background: none;
      padding-top: 4px;
      padding-bottom: 4px;
      
      &.hp-icon {
        padding-top: 0px;
        padding-bottom: 0px;
        height: 20px;
        
        .hp-delete {
          top: 7px;
        }
      }
    }
    .hp-comment-text {
      padding-right: 20px;
      max-width: 500px;
      line-height: normal;
      word-break: break-all;
    }
    .hp-timestamp {
      padding-right: 10px;
      padding-left: 0px;
    }
    .hp-comment-user {
      padding-right: 10px;
      color: $secondary-color;
      
      html.hp-high-contrast & {
        color: $projection-secondary-color;
      }
    }
    .hp-comment-delete {
      margin-left: 20px;
    }
  }
}

.hp-comment-form {
  > * {
    display: inline-block;
    vertical-align: top;
  }
  textarea {
    width: 300px;
    height: 30px;
    margin-right: 20px;
  }
  button {
    display: none;
  }
}

table.hp-heading-property-table { 
  display: block;
  max-width: 600px;
  width: 90%;
  padding-bottom: 20px;
  
  > caption {
    background-image: $horizontal-dot-url;
    background-position: left bottom;
    background-repeat: repeat-x;
    color: $secondary-color;
    text-align: left;
		display: inline-block;
    white-space: nowrap;
    width: 100%;  
      
    h3 {
      display: inline-block;
      font-size: inherit;
      margin-right: 10px;
    	white-space: normal;
    	width: 60%;
      
      &.hp-value {
        color: $primary-color;
      }
    }
    .hp-table-view-controls {
      //float: right;
      list-style-type: none;
      font-size: 0px;
      padding: 10px 0px 5px 0px;
      display:inline-block;
      text-align: right;
    	vertical-align: top;
    	white-space: nowrap;
    	width: 40%;
      
      li {
        display: inline-block;
        font-size: $body-font-size;
        margin: 0px 5px 0px 0px;
        padding: 0px 15px 0px 10px;
        border-right: 1px solid $secondary-divider;
        cursor: pointer;
        
        &:last-child {
          border-right: none;
          padding-right: 10px;
        }
        
        &:hover {
          color: $primary-color;
        }
        
        &.hp-selected {
          color: $primary-color;
          @include selection-indicator();
        }
      }
    }
  }
  
  > tbody > tr {
    background-image: none;
    
    &.hp-header {
      &:first-of-type {
        > th {
          padding-top: 10px;
        }
      }
    }
    
    > th {
      padding-top: 20px;
      height: 30px;
      line-height: 30px;
      font-size: 18px;
      font-weight: normal;
      color: $secondary-color;
      text-align: left;
    
      .hp-secondary {
        margin-left: 20px;
        color: $tertiary-color;
      }
    }
    
    > td {
      padding-left: 0px;
      padding-right: 20px;
      width: 50%;
      
      &:first-child {
        color: $secondary-color;
      }
      
      > span.hp-secondary:first-child {
        margin-left: 0px;
      }
    }
    
    > td .selectBox {
      position: relative;
      top: -7px;
      margin-bottom: 0px;
    }
    
    &.hp-active {
      td {
        border-top: 1px solid $secondary-divider;
      }
      
      .selectBox {
        margin-bottom: 0px;
      }
    }
    
    &.hp-details {
      td {
        border-bottom: 1px solid $secondary-divider;
        padding-top: 0px;
        
        pre.hp-help {
          font-family: Arial, Helvetica, sans-serif;
          white-space: pre-wrap;
        }
      }
    }
  }
  
  &.hp-expandable {
    > tbody > tr {
      > td {
        cursor: pointer;
      }
      &:hover {
        > td:first-child {
          color: $primary-color;
        }
        &.hp-details > td {
          color: $secondary-color;
        }
      }
      &.hp-active > td {
        color: $primary-color;
        cursor: auto;
      }
      &.hp-details > td {
        cursor: auto;
      }
    }
  }
}
