//
// Tables
// --------------------------------------------------


//== Table actions
//
//**
.table-actions {
  margin-bottom: @line-height-computed;
  height: 36px;
  overflow: visible;

  &>.pull-left {
    margin-right: @line-height-computed / 2;
  }

  &>.pull-right {
    margin-left: @line-height-computed / 2;

    &.master-checkbox {
      background: none;
      border-color: transparent;
      .box-shadow(none);
      padding: 0px 6px;

      color: @gray-light;
      font-size: 24px;
      line-height: 32px;

      &.active, &:active {
        top: 0px;
      }

      &.active {
        color: @brand-success;
      }
    }

    .dropdown-menu {
      left: auto;
      right: 0px;
    }
  }
}


//== Table panel
//
//**
.table-panel {
  border: 1px solid @table-panel-border;
  border-radius: @border-radius-base;
  box-shadow: 0px 0px 0px 3px @table-panel-shadow;
  margin-bottom: @line-height-computed;
}


//== Panel header
//
//**
.table-panel {
  .panel-header {

  }
}


//== Panel table
//
//**
.table-panel {
  table.table {
    margin: 0px;
  }
}


//== Table row
//
//**
.table-panel {
  table.table {
    tr {
      &.message-row {
        td {
          padding: @line-height-computed;

          p {
            margin: 0px;

            font-size: @font-size-large;
          }
        }
      }

      th {
        background: @table-header-bg;
        border: none;
        padding: @table-condensed-cell-padding @table-cell-padding;

        color: @table-header-color;
        font-size: @font-size-small;
      }

      td {
        background-color: #fff;
        vertical-align: middle;

        img {
          border-radius: @border-radius-base;
          max-width: 30px;
          max-height: 30px;
        }

        .list-unstyled {
          margin: 0px;
        }

        .item-title {
          &, a:link, a:active, a:visited, a:focus, a:hover {
            color: @text-color;
          }
        }

        &.item-thumbnail a {
          background-position: center;
          background-size: cover;
          border-radius: @border-radius-base;
          display: block;
          margin: 0px auto;
          padding: @table-condensed-cell-padding @table-cell-padding;
          width: 42px;
          height: 42px;
        }

        &.item-name {
          color: @text-color;
          font-size: @font-size-large;

          a:link, a:visited {
            color: @text-color;
          }

          small {
            display: block;
            font-size: @font-size-small;
          }
        }
      }

      &:first-child {
        &>:first-child {
          border-top-left-radius: (@border-radius-base - 1);
        }

        &>:last-child {
          border-top-right-radius: (@border-radius-base - 1);
        }
      }

      &:last-child {
        &>:first-child {
          border-bottom-left-radius: (@border-radius-base - 1);
        }

        &>:last-child {
          border-bottom-right-radius: (@border-radius-base - 1);
        }
      }
    }
  }
}


//== Row action
//
//**
.table-panel {
  table.table {
    tr {
      td.row-action {
        vertical-align: middle;
        width: 1%;

        .btn, &>form .btn, .dropdown-toggle {
          background: none;
          border-color: transparent;
          .box-shadow(none);
          padding: 0px 4px;
          position: relative;
          top: 0px;
          bottom: 0px;

          color: @gray-light;
          font-size: @font-size-base * 1.6;

          &:hover {
            top: 0px;
            bottom: 0px;

            &.btn-default {
              color: @gray;
            }

            &.btn-primary {
              color: @brand-secondary;
            }

            &.btn-danger {
              color: @brand-danger;
            }

            &.btn-warning {
              color: @brand-warning;
            }

            &.btn-success {
              color: @brand-success;
            }
          }

          &:active {
            top: 0px;
            bottom: 0px;

            &.btn-default {
              color: @gray-dark;
            }

            &.btn-primary {
              color: darken(@brand-secondary, 20%);
            }

            &.btn-danger {
              color: darken(@brand-danger, 20%);
            }

            &.btn-warning {
              color: darken(@brand-warning, 20%);
            }

            &.btn-success {
              color: darken(@brand-success, 20%);
            }
          }
        }

        .dropdown-menu {
          top: 24px;

          &:after {
            right: 9px;
          }
        }
      }
    }
  }
}


//== Row select
//
//**
.table-panel {
  table.table {
    tr {
      &.active {
        td {
          background-color: fadeOut(@brand-warning, 95%);
        }
      }

      td.row-select {
        width: 1%;

        label {
          padding: 0px;
          width: 24px;
          height: 24px;

          text-align: center;

          input {
            width: 12px;
            height: 12px;
          }

          &.ninja-label {
              border: 0;
              clip: rect(0 0 0 0);
              height: 1px;
              margin: -1px;
              overflow: hidden;
              padding: 0;
              position: absolute;
              width: 1px;
          }
        }

        a {
          display: block;
          width: 24px;
          height: 24px;

          span {
            color: lighten(@gray-light, 5%);
            font-size: 24px;
          }

          &.active {
            span {
              color: @brand-success;
            }
          }
        }
      }
    }
  }
}


//== Table footer
//
//**
.table-panel {
  .table-footer {
    background-color: @form-panel-footer-bg;
    border-radius: 0px 0px (@border-radius-large - 1px) (@border-radius-large - 1px);
    border-top: 1px solid @form-panel-border;
    padding: @form-panel-padding;
    padding-left: @table-cell-padding;
    padding-right: @table-cell-padding;

    &>.row {
      position: relative;
      left: -2px;
      margin-left: @table-cell-padding;
    }
  }
}
