//----------------------------------------------------------------------------------------------------------------------
// TABLE

.table {
  position: relative;
  width: 100%;
  background: #fff;
  text-align: left;
  font-family: Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  border: 0;
  border-collapse: collapse;

  > * > tr > * {
    vertical-align: middle;
    padding: 4px 8px;
    border: 0;
  }

  > * > tr > *:first-child {
    padding-left: 16px;
  }

  > thead > tr > * {
    color: rgba(0, 0, 0, 0.54);
    font-size: 12px;
    font-weight: 400;
  }

  &.table-condensed {
    font-size: 12px;
  }

  [data-options] {
    width: 50px;
    text-align: right;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// TABLE RESPONSIVE

.table-responsive {
  overflow-y: hidden;
  overflow-x: auto;

  .table {
    border-radius: 2px;

    // thead|tbody|tfoot > tr > th|td
    > * > tr > * {
      text-wrap: none;
      white-space: nowrap;
    }
  }
}

//----------------------------------------------------------------------------------------------------------------------
// TABLE BOXED & CARD

@media screen and (max-width: 1023px) {
  .table-card,
  .table-boxed {
    .table {

      background: none;
      border-radius: 2px;

      > thead,
      > tfoot {
        display: none;
      }

      > tbody > tr {
        position: relative;
        overflow: hidden;
        display: block;
        background: #fff;

        &:not(:last-of-type) {
          margin-bottom: 16px;
        }
      }

      // tbody > tr > th|td
      > tbody > tr > * {
        position: relative;
        width: 100% !important;
        display: block;
      }
    }

    .table {
      > * > tr > * {
        &[data-title] {
          &:before {
            content: attr(data-title);
            font-weight: 400;
            vertical-align: middle;
            line-height: 18px;
            font-size: 12px;
          }
        }

        &:not([data-stack]) {
          text-align: right;
          &:before {
            float: left;
          }
        }

        &[data-stack]:before {
          display: block;
        }

        &[data-options] {
          width: auto;
          text-align: center;
          border-top-width: 2px;
        }

      }

      &.table-condensed {
        > * > tr > * {
          &:not([data-stack]):before {
            line-height: 12px;
          }
        }
      }
    }
  }

  .table-boxed .table > tbody > tr {
    border: 1px solid #e0e0e0;
  }

  .table-card .table > tbody > tr {
    border-radius: 2px;
    -webkit-box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
    -moz-box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
    box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
  }
}

@media screen and (min-width: 1024px) {
  .table-boxed .table {
    border: 1px solid #e0e0e0;
  }
  .table-card .table {
    -webkit-box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
    -moz-box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
    box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
  }
}

//----------------------------------------------------------------------------------------------------------------------
// TABLE BORDERED

.table-bordered,
.table-bordered-row {
  // thead|tbody|tfoot:not(:first-child) > tr > th|td
  > *:not(:first-child) > tr > * {
    border-top: 1px solid #e0e0e0;
  }
}

.table-bordered,
.table-bordered-col {
  // thead|tbody|tfoot > tr > th|td:not(:first-child)
  > * > tr > *:not(:first-child) {
    border-left: 1px solid #e0e0e0;
  }
}

.table-bordered,
.table-bordered-col,
.table-bordered-row {
  // thead|tbody|tfoot > tr > th|td
  > *:not(:first-child) > tr:first-of-type > * {
    border-top: 2px solid #e0e0e0;
  }
}

.table-card,
.table-boxed {
  @media screen and (max-width: 1023px) {
    .table {
      > tbody > tr > th,
      > tbody > tr > td,
      > tbody > tr > th:first-child,
      > tbody > tr > td:first-child,
      > tbody > tr:first-child > th,
      > tbody > tr:first-child > td {
        border-top: 0;
        border-left: 0;
      }
    }

    .table-bordered,
    .table-bordered-row {
      // tbody > tr > th|td
      > tbody > tr > th:not(:first-child),
      > tbody > tr > td:not(:first-child) {
        border-top: 1px solid #e0e0e0;
      }
    }

    .table-bordered,
    .table-bordered-col,
    .table-bordered-row {
      > tbody > tr > [data-options] {
        border-top: 2px solid #e0e0e0 !important;
      }
    }
  }
}

//----------------------------------------------------------------------------------------------------------------------
// TABLE STRIPED

.table-striped {
  > tbody > tr:nth-child(odd) {
    background: rgba(0, 0, 0, .02);
  }
  > tbody > tr:nth-child(even) {
    background: none;
  }
}

.table-card,
.table-boxed {
  @media screen and (max-width: 1023px) {
    .table-striped {
      > tbody > tr:nth-child(odd),
      > tbody > tr:nth-child(even) {
        background: none;
      }

      // tbody > tr > th|td
      > tbody > tr > *:nth-child(odd) {
        background: rgba(0, 0, 0, .02);
      }
      // tbody > tr > th|td
      > tbody > tr > *:nth-child(even) {
        background: none;
      }
    }
  }
}

//----------------------------------------------------------------------------------------------------------------------
// TABLE HOVER

.table-hover {
  // tbody > tr:hover > th|td
  > tbody > tr:hover > * {
    background: rgba(0, 0, 0, .04);
  }
}

.table-card,
.table-boxed {
  @media screen and (max-width: 1023px) {
    .table-hover:not(.table-striped) {
      // tbody > tr:hover > th|td
      > tbody > tr:hover > * {
        background: inherit;
      }
    }
    .table-hover {
      // tbody > tr > th|td:hover
      > tbody > tr > *:hover {
        background: rgba(0, 0, 0, .04) !important;
      }
    }
  }
}

//----------------------------------------------------------------------------------------------------------------------
// TABLE SCREEN

.table-screen {
  width: 100%;
  height: 100%;
  overflow: scroll;
  background: #fff;

  > table {
    min-width: 100%;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// TABLE SELECTED

.table {

  .selected-row td {
    background: #bfb !important;
  }

  .selected-col {
    background: #dfd !important;
  }

}